| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webrtc_video_sink_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_video_sink_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 void WebRtcVideoSinkAdapter::RenderFrame(const cricket::VideoFrame* frame) { | 47 void WebRtcVideoSinkAdapter::RenderFrame(const cricket::VideoFrame* frame) { |
| 48 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds( | 48 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds( |
| 49 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec); | 49 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec); |
| 50 | 50 |
| 51 scoped_refptr<media::VideoFrame> video_frame; | 51 scoped_refptr<media::VideoFrame> video_frame; |
| 52 if (frame->GetNativeHandle() != NULL) { | 52 if (frame->GetNativeHandle() != NULL) { |
| 53 NativeHandleImpl* handle = | 53 NativeHandleImpl* handle = |
| 54 static_cast<NativeHandleImpl*>(frame->GetNativeHandle()); | 54 static_cast<NativeHandleImpl*>(frame->GetNativeHandle()); |
| 55 video_frame = static_cast<media::VideoFrame*>(handle->GetHandle()); | 55 video_frame = static_cast<media::VideoFrame*>(handle->GetHandle()); |
| 56 video_frame->SetTimestamp(timestamp); | 56 video_frame->set_timestamp(timestamp); |
| 57 } else { | 57 } else { |
| 58 gfx::Size size(frame->GetWidth(), frame->GetHeight()); | 58 gfx::Size size(frame->GetWidth(), frame->GetHeight()); |
| 59 video_frame = media::VideoFrame::CreateFrame( | 59 video_frame = media::VideoFrame::CreateFrame( |
| 60 media::VideoFrame::YV12, size, gfx::Rect(size), size, timestamp); | 60 media::VideoFrame::YV12, size, gfx::Rect(size), size, timestamp); |
| 61 | 61 |
| 62 // Aspect ratio unsupported; DCHECK when there are non-square pixels. | 62 // Aspect ratio unsupported; DCHECK when there are non-square pixels. |
| 63 DCHECK_EQ(frame->GetPixelWidth(), 1u); | 63 DCHECK_EQ(frame->GetPixelWidth(), 1u); |
| 64 DCHECK_EQ(frame->GetPixelHeight(), 1u); | 64 DCHECK_EQ(frame->GetPixelHeight(), 1u); |
| 65 | 65 |
| 66 int y_rows = frame->GetHeight(); | 66 int y_rows = frame->GetHeight(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 void WebRtcVideoSinkAdapter::DoRenderFrameOnMainThread( | 112 void WebRtcVideoSinkAdapter::DoRenderFrameOnMainThread( |
| 113 scoped_refptr<media::VideoFrame> video_frame) { | 113 scoped_refptr<media::VideoFrame> video_frame) { |
| 114 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 114 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
| 115 sink_->OnVideoFrame(video_frame); | 115 sink_->OnVideoFrame(video_frame); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace content | 118 } // namespace content |
| OLD | NEW |