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 "media/filters/rtc_video_decoder.h" | 5 #include "media/filters/rtc_video_decoder.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 | 8 |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 DCHECK_EQ(MessageLoop::current(), message_loop_); | 107 DCHECK_EQ(MessageLoop::current(), message_loop_); |
108 | 108 |
109 state_ = kStopped; | 109 state_ = kStopped; |
110 | 110 |
111 VideoDecoder::Stop(callback); | 111 VideoDecoder::Stop(callback); |
112 | 112 |
113 // TODO(ronghuawu): Stop rtc | 113 // TODO(ronghuawu): Stop rtc |
114 } | 114 } |
115 | 115 |
116 void RTCVideoDecoder::Seek(base::TimeDelta time, | 116 void RTCVideoDecoder::Seek(base::TimeDelta time, const FilterStatusCB& cb) { |
117 FilterCallback* callback) { | |
118 if (MessageLoop::current() != message_loop_) { | 117 if (MessageLoop::current() != message_loop_) { |
119 message_loop_->PostTask(FROM_HERE, | 118 message_loop_->PostTask(FROM_HERE, |
120 NewRunnableMethod(this, | 119 NewRunnableMethod(this, &RTCVideoDecoder::Seek, |
121 &RTCVideoDecoder::Seek, | 120 time, cb)); |
122 time, | |
123 callback)); | |
124 return; | 121 return; |
125 } | 122 } |
126 | 123 |
127 DCHECK_EQ(MessageLoop::current(), message_loop_); | 124 DCHECK_EQ(MessageLoop::current(), message_loop_); |
128 | 125 |
129 state_ = kSeeking; | 126 state_ = kSeeking; |
130 // Create output buffer pool and pass the frames to renderer | 127 // Create output buffer pool and pass the frames to renderer |
131 // so that the renderer can complete the seeking | 128 // so that the renderer can complete the seeking |
132 for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) { | 129 for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) { |
133 scoped_refptr<VideoFrame> video_frame; | 130 scoped_refptr<VideoFrame> video_frame; |
(...skipping 24 matching lines...) Expand all Loading... |
158 memset(v_plane, kBlackUV, width_ / 2); | 155 memset(v_plane, kBlackUV, width_ / 2); |
159 u_plane += video_frame->stride(VideoFrame::kUPlane); | 156 u_plane += video_frame->stride(VideoFrame::kUPlane); |
160 v_plane += video_frame->stride(VideoFrame::kVPlane); | 157 v_plane += video_frame->stride(VideoFrame::kVPlane); |
161 } | 158 } |
162 | 159 |
163 VideoFrameReady(video_frame); | 160 VideoFrameReady(video_frame); |
164 } | 161 } |
165 | 162 |
166 state_ = kNormal; | 163 state_ = kNormal; |
167 | 164 |
168 callback->Run(); | 165 cb.Run(PIPELINE_OK); |
169 delete callback; | |
170 | 166 |
171 // TODO(ronghuawu): Start rtc | 167 // TODO(ronghuawu): Start rtc |
172 } | 168 } |
173 | 169 |
174 const MediaFormat& RTCVideoDecoder::media_format() { | 170 const MediaFormat& RTCVideoDecoder::media_format() { |
175 return media_format_; | 171 return media_format_; |
176 } | 172 } |
177 | 173 |
178 void RTCVideoDecoder::ProduceVideoFrame( | 174 void RTCVideoDecoder::ProduceVideoFrame( |
179 scoped_refptr<VideoFrame> video_frame) { | 175 scoped_refptr<VideoFrame> video_frame) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 268 |
273 return 0; | 269 return 0; |
274 } | 270 } |
275 | 271 |
276 bool RTCVideoDecoder::IsUrlSupported(const std::string& url) { | 272 bool RTCVideoDecoder::IsUrlSupported(const std::string& url) { |
277 GURL gurl(url); | 273 GURL gurl(url); |
278 return gurl.SchemeIs(kMediaScheme); | 274 return gurl.SchemeIs(kMediaScheme); |
279 } | 275 } |
280 | 276 |
281 } // namespace media | 277 } // namespace media |
OLD | NEW |