| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const std::string& url) | 32 const std::string& url) |
| 33 : message_loop_(message_loop), | 33 : message_loop_(message_loop), |
| 34 visible_size_(176, 144), | 34 visible_size_(176, 144), |
| 35 url_(url), | 35 url_(url), |
| 36 state_(kUnInitialized) { | 36 state_(kUnInitialized) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 RTCVideoDecoder::~RTCVideoDecoder() {} | 39 RTCVideoDecoder::~RTCVideoDecoder() {} |
| 40 | 40 |
| 41 void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream, | 41 void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream, |
| 42 const base::Closure& filter_callback, | 42 const media::PipelineStatusCB& filter_callback, |
| 43 const StatisticsCallback& stat_callback) { | 43 const StatisticsCallback& stat_callback) { |
| 44 if (MessageLoop::current() != message_loop_) { | 44 if (MessageLoop::current() != message_loop_) { |
| 45 message_loop_->PostTask( | 45 message_loop_->PostTask( |
| 46 FROM_HERE, | 46 FROM_HERE, |
| 47 base::Bind(&RTCVideoDecoder::Initialize, this, | 47 base::Bind(&RTCVideoDecoder::Initialize, this, |
| 48 make_scoped_refptr(demuxer_stream), | 48 make_scoped_refptr(demuxer_stream), |
| 49 filter_callback, stat_callback)); | 49 filter_callback, stat_callback)); |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 | 52 |
| 53 DCHECK_EQ(MessageLoop::current(), message_loop_); | 53 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 54 state_ = kNormal; | 54 state_ = kNormal; |
| 55 filter_callback.Run(); | 55 filter_callback.Run(PIPELINE_OK); |
| 56 | 56 |
| 57 // TODO(acolwell): Implement stats. | 57 // TODO(acolwell): Implement stats. |
| 58 } | 58 } |
| 59 | 59 |
| 60 void RTCVideoDecoder::Play(const base::Closure& callback) { | 60 void RTCVideoDecoder::Play(const base::Closure& callback) { |
| 61 if (MessageLoop::current() != message_loop_) { | 61 if (MessageLoop::current() != message_loop_) { |
| 62 message_loop_->PostTask(FROM_HERE, | 62 message_loop_->PostTask(FROM_HERE, |
| 63 base::Bind(&RTCVideoDecoder::Play, | 63 base::Bind(&RTCVideoDecoder::Play, |
| 64 this, callback)); | 64 this, callback)); |
| 65 return; | 65 return; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 int y_rows = frame->GetHeight(); | 204 int y_rows = frame->GetHeight(); |
| 205 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 205 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
| 206 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 206 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
| 207 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); | 207 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); |
| 208 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); | 208 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); |
| 209 | 209 |
| 210 read_cb.Run(video_frame); | 210 read_cb.Run(video_frame); |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| OLD | NEW |