OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h" | 5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // reference counted frame buffer. Const cast and hope no one will overwrite | 108 // reference counted frame buffer. Const cast and hope no one will overwrite |
109 // the data. | 109 // the data. |
110 // TODO(magjed): Update media::VideoFrame to support const data so we don't | 110 // TODO(magjed): Update media::VideoFrame to support const data so we don't |
111 // need to const cast here. | 111 // need to const cast here. |
112 video_frame = media::VideoFrame::WrapExternalYuvData( | 112 video_frame = media::VideoFrame::WrapExternalYuvData( |
113 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, | 113 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, |
114 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), | 114 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), |
115 const_cast<uint8_t*>(frame->GetYPlane()), | 115 const_cast<uint8_t*>(frame->GetYPlane()), |
116 const_cast<uint8_t*>(frame->GetUPlane()), | 116 const_cast<uint8_t*>(frame->GetUPlane()), |
117 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); | 117 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); |
| 118 if (!video_frame) |
| 119 return; |
118 video_frame->AddDestructionObserver( | 120 video_frame->AddDestructionObserver( |
119 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); | 121 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); |
120 } | 122 } |
121 | 123 |
122 video_frame->metadata()->SetTimeTicks( | 124 video_frame->metadata()->SetTimeTicks( |
123 media::VideoFrameMetadata::REFERENCE_TIME, render_time); | 125 media::VideoFrameMetadata::REFERENCE_TIME, render_time); |
124 | 126 |
125 io_task_runner_->PostTask( | 127 io_task_runner_->PostTask( |
126 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, | 128 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, |
127 this, video_frame)); | 129 this, video_frame)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 case webrtc::MediaStreamTrackInterface::kEnded: | 217 case webrtc::MediaStreamTrackInterface::kEnded: |
216 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 218 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
217 break; | 219 break; |
218 default: | 220 default: |
219 NOTREACHED(); | 221 NOTREACHED(); |
220 break; | 222 break; |
221 } | 223 } |
222 } | 224 } |
223 | 225 |
224 } // namespace content | 226 } // namespace content |
OLD | NEW |