| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // reference counted frame buffer. Const cast and hope no one will overwrite | 112 // reference counted frame buffer. Const cast and hope no one will overwrite |
| 113 // the data. | 113 // the data. |
| 114 // TODO(magjed): Update media::VideoFrame to support const data so we don't | 114 // TODO(magjed): Update media::VideoFrame to support const data so we don't |
| 115 // need to const cast here. | 115 // need to const cast here. |
| 116 video_frame = media::VideoFrame::WrapExternalYuvData( | 116 video_frame = media::VideoFrame::WrapExternalYuvData( |
| 117 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, | 117 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, |
| 118 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), | 118 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), |
| 119 const_cast<uint8_t*>(frame->GetYPlane()), | 119 const_cast<uint8_t*>(frame->GetYPlane()), |
| 120 const_cast<uint8_t*>(frame->GetUPlane()), | 120 const_cast<uint8_t*>(frame->GetUPlane()), |
| 121 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); | 121 const_cast<uint8_t*>(frame->GetVPlane()), elapsed_timestamp); |
| 122 if (!video_frame) |
| 123 return; |
| 122 video_frame->AddDestructionObserver( | 124 video_frame->AddDestructionObserver( |
| 123 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); | 125 base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy())); |
| 124 } | 126 } |
| 125 | 127 |
| 126 video_frame->metadata()->SetTimeTicks( | 128 video_frame->metadata()->SetTimeTicks( |
| 127 media::VideoFrameMetadata::REFERENCE_TIME, render_time); | 129 media::VideoFrameMetadata::REFERENCE_TIME, render_time); |
| 128 | 130 |
| 129 io_task_runner_->PostTask( | 131 io_task_runner_->PostTask( |
| 130 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, | 132 FROM_HERE, base::Bind(&RemoteVideoSourceDelegate::DoRenderFrameOnIOThread, |
| 131 this, video_frame)); | 133 this, video_frame)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 case webrtc::MediaStreamTrackInterface::kEnded: | 221 case webrtc::MediaStreamTrackInterface::kEnded: |
| 220 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 222 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
| 221 break; | 223 break; |
| 222 default: | 224 default: |
| 223 NOTREACHED(); | 225 NOTREACHED(); |
| 224 break; | 226 break; |
| 225 } | 227 } |
| 226 } | 228 } |
| 227 | 229 |
| 228 } // namespace content | 230 } // namespace content |
| OLD | NEW |