| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // reference counted frame buffer. Const cast and hope no one will overwrite | 109 // reference counted frame buffer. Const cast and hope no one will overwrite |
| 110 // the data. | 110 // the data. |
| 111 // TODO(magjed): Update media::VideoFrame to support const data so we don't | 111 // TODO(magjed): Update media::VideoFrame to support const data so we don't |
| 112 // need to const cast here. | 112 // need to const cast here. |
| 113 video_frame = media::VideoFrame::WrapExternalYuvData( | 113 video_frame = media::VideoFrame::WrapExternalYuvData( |
| 114 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, | 114 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, |
| 115 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), | 115 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), |
| 116 const_cast<uint8_t*>(frame->GetYPlane()), | 116 const_cast<uint8_t*>(frame->GetYPlane()), |
| 117 const_cast<uint8_t*>(frame->GetUPlane()), | 117 const_cast<uint8_t*>(frame->GetUPlane()), |
| 118 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); | 118 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); |
| 119 if (!video_frame) |
| 120 return; |
| 119 video_frame->AddDestructionObserver( | 121 video_frame->AddDestructionObserver( |
| 120 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); | 122 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); |
| 121 } | 123 } |
| 122 | 124 |
| 123 video_frame->metadata()->SetTimeTicks( | 125 video_frame->metadata()->SetTimeTicks( |
| 124 media::VideoFrameMetadata::REFERENCE_TIME, render_time); | 126 media::VideoFrameMetadata::REFERENCE_TIME, render_time); |
| 125 | 127 |
| 126 io_task_runner_->PostTask( | 128 io_task_runner_->PostTask( |
| 127 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, | 129 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, |
| 128 this, video_frame)); | 130 this, video_frame)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 case webrtc::MediaStreamTrackInterface::kEnded: | 204 case webrtc::MediaStreamTrackInterface::kEnded: |
| 203 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 205 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
| 204 break; | 206 break; |
| 205 default: | 207 default: |
| 206 NOTREACHED(); | 208 NOTREACHED(); |
| 207 break; | 209 break; |
| 208 } | 210 } |
| 209 } | 211 } |
| 210 | 212 |
| 211 } // namespace content | 213 } // namespace content |
| OLD | NEW |