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 "content/renderer/media/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" | |
11 #include "media/base/callback.h" | 10 #include "media/base/callback.h" |
12 #include "media/base/filter_host.h" | 11 #include "media/base/filter_host.h" |
13 #include "media/base/filters.h" | 12 #include "media/base/filters.h" |
14 #include "media/base/limits.h" | 13 #include "media/base/limits.h" |
15 #include "media/base/media_format.h" | 14 #include "media/base/media_format.h" |
16 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
17 | 16 |
18 namespace media { | 17 using media::DemuxerStream; |
19 | 18 using media::FilterCallback; |
20 static const char kMediaScheme[] = "media"; | 19 using media::FilterStatusCB; |
20 using media::kNoTimestamp; | |
21 using media::Limits; | |
22 using media::MediaFormat; | |
23 using media::PIPELINE_OK; | |
24 using media::StatisticsCallback; | |
25 using media::VideoDecoder; | |
26 using media::VideoFrame; | |
21 | 27 |
22 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop, | 28 RTCVideoDecoder::RTCVideoDecoder(MessageLoop* message_loop, |
23 const std::string& url) | 29 const std::string& url) |
24 : message_loop_(message_loop), | 30 : message_loop_(message_loop), |
25 width_(176), | 31 width_(176), |
26 height_(144), | 32 height_(144), |
27 url_(url), | 33 url_(url), |
28 state_(kUnInitialized) { | 34 state_(kUnInitialized) { |
29 } | 35 } |
30 | 36 |
(...skipping 16 matching lines...) Expand all Loading... | |
47 DCHECK_EQ(MessageLoop::current(), message_loop_); | 53 DCHECK_EQ(MessageLoop::current(), message_loop_); |
48 | 54 |
49 lock_.Acquire(); | 55 lock_.Acquire(); |
50 frame_queue_available_.clear(); | 56 frame_queue_available_.clear(); |
51 lock_.Release(); | 57 lock_.Release(); |
52 media_format_.SetAsInteger(MediaFormat::kWidth, width_); | 58 media_format_.SetAsInteger(MediaFormat::kWidth, width_); |
53 media_format_.SetAsInteger(MediaFormat::kHeight, height_); | 59 media_format_.SetAsInteger(MediaFormat::kHeight, height_); |
54 media_format_.SetAsInteger(MediaFormat::kSurfaceType, | 60 media_format_.SetAsInteger(MediaFormat::kSurfaceType, |
55 static_cast<int>(VideoFrame::YV12)); | 61 static_cast<int>(VideoFrame::YV12)); |
56 media_format_.SetAsInteger(MediaFormat::kSurfaceFormat, | 62 media_format_.SetAsInteger(MediaFormat::kSurfaceFormat, |
57 static_cast<int>(VideoFrame::TYPE_SYSTEM_MEMORY)); | 63 static_cast<int>(VideoFrame::TYPE_SYSTEM_MEMORY)); |
scherkus (not reviewing)
2011/06/29 00:39:28
why was this changed?
Ronghua
2011/06/29 20:36:39
Done.
| |
58 | 64 |
59 state_ = kNormal; | 65 state_ = kNormal; |
60 | 66 |
61 filter_callback->Run(); | 67 filter_callback->Run(); |
62 delete filter_callback; | 68 delete filter_callback; |
63 | 69 |
64 // TODO(acolwell): Implement stats. | 70 // TODO(acolwell): Implement stats. |
65 delete stat_callback; | 71 delete stat_callback; |
66 } | 72 } |
67 | 73 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 112 |
107 DCHECK_EQ(MessageLoop::current(), message_loop_); | 113 DCHECK_EQ(MessageLoop::current(), message_loop_); |
108 | 114 |
109 state_ = kStopped; | 115 state_ = kStopped; |
110 | 116 |
111 VideoDecoder::Stop(callback); | 117 VideoDecoder::Stop(callback); |
112 | 118 |
113 // TODO(ronghuawu): Stop rtc | 119 // TODO(ronghuawu): Stop rtc |
114 } | 120 } |
115 | 121 |
116 void RTCVideoDecoder::Seek(base::TimeDelta time, const FilterStatusCB& cb) { | 122 void RTCVideoDecoder::Seek(base::TimeDelta time, |
123 const FilterStatusCB& cb) { | |
scherkus (not reviewing)
2011/06/29 00:39:28
why was this dropped to next line?
Ronghua
2011/06/29 20:36:39
Done.
| |
117 if (MessageLoop::current() != message_loop_) { | 124 if (MessageLoop::current() != message_loop_) { |
118 message_loop_->PostTask(FROM_HERE, | 125 message_loop_->PostTask(FROM_HERE, |
119 NewRunnableMethod(this, &RTCVideoDecoder::Seek, | 126 NewRunnableMethod(this, &RTCVideoDecoder::Seek, |
120 time, cb)); | 127 time, cb)); |
121 return; | 128 return; |
122 } | 129 } |
123 | 130 |
124 DCHECK_EQ(MessageLoop::current(), message_loop_); | 131 DCHECK_EQ(MessageLoop::current(), message_loop_); |
125 | 132 |
126 state_ = kSeeking; | 133 state_ = kSeeking; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 FROM_HERE, | 268 FROM_HERE, |
262 NewRunnableMethod(this, | 269 NewRunnableMethod(this, |
263 &RTCVideoDecoder::VideoFrameReady, | 270 &RTCVideoDecoder::VideoFrameReady, |
264 video_frame)); | 271 video_frame)); |
265 } else { | 272 } else { |
266 VideoFrameReady(video_frame); | 273 VideoFrameReady(video_frame); |
267 } | 274 } |
268 | 275 |
269 return 0; | 276 return 0; |
270 } | 277 } |
271 | |
272 bool RTCVideoDecoder::IsUrlSupported(const std::string& url) { | |
273 GURL gurl(url); | |
274 return gurl.SchemeIs(kMediaScheme); | |
275 } | |
276 | |
277 } // namespace media | |
OLD | NEW |