| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (incoming_frame->GetNativeHandle() != NULL) { | 97 if (incoming_frame->GetNativeHandle() != NULL) { |
| 98 video_frame = | 98 video_frame = |
| 99 static_cast<media::VideoFrame*>(incoming_frame->GetNativeHandle()); | 99 static_cast<media::VideoFrame*>(incoming_frame->GetNativeHandle()); |
| 100 video_frame->set_timestamp(elapsed_timestamp); | 100 video_frame->set_timestamp(elapsed_timestamp); |
| 101 } else { | 101 } else { |
| 102 const cricket::VideoFrame* frame = | 102 const cricket::VideoFrame* frame = |
| 103 incoming_frame->GetCopyWithRotationApplied(); | 103 incoming_frame->GetCopyWithRotationApplied(); |
| 104 | 104 |
| 105 gfx::Size size(frame->GetWidth(), frame->GetHeight()); | 105 gfx::Size size(frame->GetWidth(), frame->GetHeight()); |
| 106 | 106 |
| 107 // Non-square pixels are unsupported. | |
| 108 DCHECK_EQ(frame->GetPixelWidth(), 1u); | |
| 109 DCHECK_EQ(frame->GetPixelHeight(), 1u); | |
| 110 | |
| 111 // Make a shallow copy. Both |frame| and |video_frame| will share a single | 107 // Make a shallow copy. Both |frame| and |video_frame| will share a single |
| 112 // 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 |
| 113 // the data. | 109 // the data. |
| 114 // 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 |
| 115 // need to const cast here. | 111 // need to const cast here. |
| 116 video_frame = media::VideoFrame::WrapExternalYuvData( | 112 video_frame = media::VideoFrame::WrapExternalYuvData( |
| 117 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, | 113 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, |
| 118 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), | 114 frame->GetYPitch(), frame->GetUPitch(), frame->GetVPitch(), |
| 119 const_cast<uint8_t*>(frame->GetYPlane()), | 115 const_cast<uint8_t*>(frame->GetYPlane()), |
| 120 const_cast<uint8_t*>(frame->GetUPlane()), | 116 const_cast<uint8_t*>(frame->GetUPlane()), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 case webrtc::MediaStreamTrackInterface::kEnded: | 215 case webrtc::MediaStreamTrackInterface::kEnded: |
| 220 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 216 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
| 221 break; | 217 break; |
| 222 default: | 218 default: |
| 223 NOTREACHED(); | 219 NOTREACHED(); |
| 224 break; | 220 break; |
| 225 } | 221 } |
| 226 } | 222 } |
| 227 | 223 |
| 228 } // namespace content | 224 } // namespace content |
| OLD | NEW |