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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "media/base/demuxer.h" | 12 #include "media/base/demuxer.h" |
13 #include "media/base/filter_host.h" | 13 #include "media/base/filter_host.h" |
14 #include "media/base/filters.h" | 14 #include "media/base/filters.h" |
15 #include "media/base/limits.h" | 15 #include "media/base/limits.h" |
16 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
17 #include "media/base/video_util.h" | 17 #include "media/base/video_util.h" |
18 #include "third_party/libjingle/source/talk/session/phone/videoframe.h" | 18 #include "third_party/libjingle/source/talk/session/phone/videoframe.h" |
19 | 19 |
20 using media::CopyUPlane; | 20 using media::CopyUPlane; |
21 using media::CopyVPlane; | 21 using media::CopyVPlane; |
22 using media::CopyYPlane; | 22 using media::CopyYPlane; |
23 using media::DemuxerStream; | 23 using media::DemuxerStream; |
24 using media::FilterStatusCB; | 24 using media::PipelineStatusCB; |
25 using media::kNoTimestamp; | 25 using media::kNoTimestamp; |
26 using media::PIPELINE_OK; | 26 using media::PIPELINE_OK; |
27 using media::PipelineStatusCB; | 27 using media::PipelineStatusCB; |
28 using media::StatisticsCB; | 28 using media::StatisticsCB; |
29 using media::VideoDecoder; | 29 using media::VideoDecoder; |
30 | 30 |
31 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop, | 31 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop, |
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), |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return; | 122 return; |
123 } | 123 } |
124 | 124 |
125 DCHECK_EQ(MessageLoop::current(), message_loop_); | 125 DCHECK_EQ(MessageLoop::current(), message_loop_); |
126 | 126 |
127 state_ = kStopped; | 127 state_ = kStopped; |
128 | 128 |
129 VideoDecoder::Stop(callback); | 129 VideoDecoder::Stop(callback); |
130 } | 130 } |
131 | 131 |
132 void RTCVideoDecoder::Seek(base::TimeDelta time, const FilterStatusCB& cb) { | 132 void RTCVideoDecoder::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { |
133 if (MessageLoop::current() != message_loop_) { | 133 if (MessageLoop::current() != message_loop_) { |
134 message_loop_->PostTask(FROM_HERE, | 134 message_loop_->PostTask(FROM_HERE, |
135 base::Bind(&RTCVideoDecoder::Seek, this, | 135 base::Bind(&RTCVideoDecoder::Seek, this, |
136 time, cb)); | 136 time, cb)); |
137 return; | 137 return; |
138 } | 138 } |
139 | 139 |
140 DCHECK_EQ(MessageLoop::current(), message_loop_); | 140 DCHECK_EQ(MessageLoop::current(), message_loop_); |
141 state_ = kNormal; | 141 state_ = kNormal; |
142 cb.Run(PIPELINE_OK); | 142 cb.Run(PIPELINE_OK); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 int y_rows = frame->GetHeight(); | 218 int y_rows = frame->GetHeight(); |
219 int uv_rows = frame->GetHeight() / 2; // YV12 format. | 219 int uv_rows = frame->GetHeight() / 2; // YV12 format. |
220 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); | 220 CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame); |
221 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); | 221 CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame); |
222 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); | 222 CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame); |
223 | 223 |
224 read_cb.Run(video_frame); | 224 read_cb.Run(video_frame); |
225 return true; | 225 return true; |
226 } | 226 } |
OLD | NEW |