| 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_decoder.h" | 5 #include "content/renderer/media/rtc_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 base::AutoLock auto_lock(lock_); | 100 base::AutoLock auto_lock(lock_); |
| 101 if (!read_cb_.is_null()) { | 101 if (!read_cb_.is_null()) { |
| 102 std::swap(read_cb, read_cb_); | 102 std::swap(read_cb, read_cb_); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 if (!read_cb.is_null()) { | 106 if (!read_cb.is_null()) { |
| 107 scoped_refptr<media::VideoFrame> video_frame = | 107 scoped_refptr<media::VideoFrame> video_frame = |
| 108 media::VideoFrame::CreateBlackFrame(visible_size_.width(), | 108 media::VideoFrame::CreateBlackFrame(visible_size_.width(), |
| 109 visible_size_.height()); | 109 visible_size_.height()); |
| 110 read_cb.Run(video_frame); | 110 read_cb.Run(video_frame, kOk); |
| 111 } | 111 } |
| 112 | 112 |
| 113 VideoDecoder::Flush(callback); | 113 VideoDecoder::Flush(callback); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void RTCVideoDecoder::Stop(const base::Closure& callback) { | 116 void RTCVideoDecoder::Stop(const base::Closure& callback) { |
| 117 if (MessageLoop::current() != message_loop_) { | 117 if (MessageLoop::current() != message_loop_) { |
| 118 message_loop_->PostTask(FROM_HERE, | 118 message_loop_->PostTask(FROM_HERE, |
| 119 base::Bind(&RTCVideoDecoder::Stop, | 119 base::Bind(&RTCVideoDecoder::Stop, |
| 120 this, callback)); | 120 this, callback)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Aspect ratio unsupported; DCHECK when there are non-square pixels. | 217 // Aspect ratio unsupported; DCHECK when there are non-square pixels. |
| 218 DCHECK_EQ(frame->GetPixelWidth(), 1u); | 218 DCHECK_EQ(frame->GetPixelWidth(), 1u); |
| 219 DCHECK_EQ(frame->GetPixelHeight(), 1u); | 219 DCHECK_EQ(frame->GetPixelHeight(), 1u); |
| 220 | 220 |
| 221 int y_rows = frame->GetHeight(); | 221 int y_rows = frame->GetHeight(); |
| 222 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 222 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
| 223 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 223 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
| 224 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); | 224 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); |
| 225 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); | 225 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); |
| 226 | 226 |
| 227 read_cb.Run(video_frame); | 227 read_cb.Run(video_frame, kOk); |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| OLD | NEW |