| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/rtc_video_renderer.h" | 5 #include "content/renderer/media/rtc_video_renderer.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_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void RTCVideoRenderer::SetSize(int width, int height) { | 68 void RTCVideoRenderer::SetSize(int width, int height) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RTCVideoRenderer::RenderFrame(const cricket::VideoFrame* frame) { | 71 void RTCVideoRenderer::RenderFrame(const cricket::VideoFrame* frame) { |
| 72 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds( | 72 base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds( |
| 73 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec); | 73 frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec); |
| 74 gfx::Size size(frame->GetWidth(), frame->GetHeight()); | 74 gfx::Size size(frame->GetWidth(), frame->GetHeight()); |
| 75 scoped_refptr<media::VideoFrame> video_frame = | 75 scoped_refptr<media::VideoFrame> video_frame = |
| 76 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, | 76 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, |
| 77 size, | 77 size, |
| 78 gfx::Rect(size), |
| 78 size, | 79 size, |
| 79 timestamp); | 80 timestamp); |
| 80 | 81 |
| 81 // Aspect ratio unsupported; DCHECK when there are non-square pixels. | 82 // Aspect ratio unsupported; DCHECK when there are non-square pixels. |
| 82 DCHECK_EQ(frame->GetPixelWidth(), 1u); | 83 DCHECK_EQ(frame->GetPixelWidth(), 1u); |
| 83 DCHECK_EQ(frame->GetPixelHeight(), 1u); | 84 DCHECK_EQ(frame->GetPixelHeight(), 1u); |
| 84 | 85 |
| 85 int y_rows = frame->GetHeight(); | 86 int y_rows = frame->GetHeight(); |
| 86 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 87 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
| 87 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 88 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 98 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 99 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
| 99 | 100 |
| 100 if (state_ != kStarted) { | 101 if (state_ != kStarted) { |
| 101 return; | 102 return; |
| 102 } | 103 } |
| 103 | 104 |
| 104 repaint_cb_.Run(video_frame); | 105 repaint_cb_.Run(video_frame); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace content | 108 } // namespace content |
| OLD | NEW |