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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 scoped_refptr<media::VideoFrame> video_frame; | 97 scoped_refptr<media::VideoFrame> video_frame; |
98 if (incoming_frame.GetNativeHandle() != NULL) { | 98 if (incoming_frame.GetNativeHandle() != NULL) { |
99 video_frame = | 99 video_frame = |
100 static_cast<media::VideoFrame*>(incoming_frame.GetNativeHandle()); | 100 static_cast<media::VideoFrame*>(incoming_frame.GetNativeHandle()); |
101 video_frame->set_timestamp(elapsed_timestamp); | 101 video_frame->set_timestamp(elapsed_timestamp); |
102 } else { | 102 } else { |
103 const cricket::VideoFrame* frame = | 103 const cricket::VideoFrame* frame = |
104 incoming_frame.GetCopyWithRotationApplied(); | 104 incoming_frame.GetCopyWithRotationApplied(); |
105 | 105 |
106 gfx::Size size(frame->GetWidth(), frame->GetHeight()); | 106 gfx::Size size(frame->width(), frame->height()); |
107 | 107 |
108 // Make a shallow copy. Both |frame| and |video_frame| will share a single | 108 // Make a shallow copy. Both |frame| and |video_frame| will share a single |
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()), |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 case webrtc::MediaStreamTrackInterface::kEnded: | 214 case webrtc::MediaStreamTrackInterface::kEnded: |
215 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 215 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
216 break; | 216 break; |
217 default: | 217 default: |
218 NOTREACHED(); | 218 NOTREACHED(); |
219 break; | 219 break; |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
OLD | NEW |