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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 DCHECK_EQ(MessageLoop::current(), message_loop_); | 54 DCHECK_EQ(MessageLoop::current(), message_loop_); |
55 state_ = kNormal; | 55 state_ = kNormal; |
56 status_cb.Run(PIPELINE_OK); | 56 status_cb.Run(PIPELINE_OK); |
57 | 57 |
58 // TODO(acolwell): Implement stats. | 58 // TODO(acolwell): Implement stats. |
59 } | 59 } |
60 | 60 |
61 void RTCVideoDecoder::Play(const base::Closure& callback) { | 61 void RTCVideoDecoder::Play(const base::Closure& callback) { |
62 if (MessageLoop::current() != message_loop_) { | 62 if (MessageLoop::current() != message_loop_) { |
63 message_loop_->PostTask(FROM_HERE, | 63 message_loop_->PostTask(FROM_HERE, |
64 base::Bind(&RTCVideoDecoder::Play, | 64 base::Bind(&RTCVideoDecoder::Play, this, callback)); |
65 this, callback)); | |
66 return; | 65 return; |
67 } | 66 } |
68 | 67 |
69 DCHECK_EQ(MessageLoop::current(), message_loop_); | 68 DCHECK_EQ(MessageLoop::current(), message_loop_); |
70 | 69 |
71 VideoDecoder::Play(callback); | 70 callback.Run(); |
72 } | 71 } |
73 | 72 |
74 void RTCVideoDecoder::Pause(const base::Closure& callback) { | 73 void RTCVideoDecoder::Pause(const base::Closure& callback) { |
75 if (MessageLoop::current() != message_loop_) { | 74 if (MessageLoop::current() != message_loop_) { |
76 message_loop_->PostTask(FROM_HERE, | 75 message_loop_->PostTask(FROM_HERE, |
77 base::Bind(&RTCVideoDecoder::Pause, | 76 base::Bind(&RTCVideoDecoder::Pause, |
78 this, callback)); | 77 this, callback)); |
79 return; | 78 return; |
80 } | 79 } |
81 | 80 |
82 DCHECK_EQ(MessageLoop::current(), message_loop_); | 81 DCHECK_EQ(MessageLoop::current(), message_loop_); |
83 | 82 |
84 state_ = kPaused; | 83 state_ = kPaused; |
85 | 84 |
86 VideoDecoder::Pause(callback); | 85 callback.Run(); |
87 } | 86 } |
88 | 87 |
89 void RTCVideoDecoder::Flush(const base::Closure& callback) { | 88 void RTCVideoDecoder::Flush(const base::Closure& callback) { |
90 if (MessageLoop::current() != message_loop_) { | 89 if (MessageLoop::current() != message_loop_) { |
91 message_loop_->PostTask(FROM_HERE, | 90 message_loop_->PostTask(FROM_HERE, |
92 base::Bind(&RTCVideoDecoder::Flush, | 91 base::Bind(&RTCVideoDecoder::Flush, |
93 this, callback)); | 92 this, callback)); |
94 return; | 93 return; |
95 } | 94 } |
96 | 95 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 216 |
218 int y_rows = frame->GetHeight(); | 217 int y_rows = frame->GetHeight(); |
219 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 218 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
220 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 219 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
221 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); | 220 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); |
222 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); | 221 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); |
223 | 222 |
224 read_cb.Run(video_frame); | 223 read_cb.Run(video_frame); |
225 return true; | 224 return true; |
226 } | 225 } |
OLD | NEW |