OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_factory_tv.h" | 5 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" | 8 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" |
9 #include "media/base/audio_decoder_config.h" | 9 #include "media/base/audio_decoder_config.h" |
10 #include "media/base/bind_to_loop.h" | 10 #include "media/base/bind_to_loop.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (buffer) | 96 if (buffer) |
97 frame_rate_tracker_.Update(1); | 97 frame_rate_tracker_.Update(1); |
98 DVLOG(1) << "frame rate received : " << frame_rate_tracker_.units_second(); | 98 DVLOG(1) << "frame rate received : " << frame_rate_tracker_.units_second(); |
99 RunReadCallback_Locked(); | 99 RunReadCallback_Locked(); |
100 } | 100 } |
101 | 101 |
102 void RTCDemuxerStream::Read(const ReadCB& read_cb) { | 102 void RTCDemuxerStream::Read(const ReadCB& read_cb) { |
103 base::AutoLock lock(lock_); | 103 base::AutoLock lock(lock_); |
104 DCHECK(read_cb_.is_null()); | 104 DCHECK(read_cb_.is_null()); |
105 if (is_destroyed_) { | 105 if (is_destroyed_) { |
106 media::BindToLoop(base::MessageLoopProxy::current(), read_cb) | 106 base::MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind( |
107 .Run(DemuxerStream::kAborted, NULL); | 107 read_cb, DemuxerStream::kAborted, NULL)); |
108 return; | 108 return; |
109 } | 109 } |
110 read_cb_ = media::BindToLoop(base::MessageLoopProxy::current(), read_cb); | 110 read_cb_ = media::BindToCurrentLoop(read_cb); |
111 RunReadCallback_Locked(); | 111 RunReadCallback_Locked(); |
112 } | 112 } |
113 | 113 |
114 void RTCDemuxerStream::Destroy() { | 114 void RTCDemuxerStream::Destroy() { |
115 base::AutoLock lock(lock_); | 115 base::AutoLock lock(lock_); |
116 DCHECK(!is_destroyed_); | 116 DCHECK(!is_destroyed_); |
117 is_destroyed_ = true; | 117 is_destroyed_ = true; |
118 if (!read_cb_.is_null()) | 118 if (!read_cb_.is_null()) |
119 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, NULL); | 119 base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, NULL); |
120 while (!buffer_queue_.empty()) | 120 while (!buffer_queue_.empty()) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (stream_) { | 190 if (stream_) { |
191 stream_->Destroy(); | 191 stream_->Destroy(); |
192 stream_.reset(); | 192 stream_.reset(); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 void RTCVideoDecoderFactoryTv::Initialize(media::DemuxerHost* /*host*/, | 196 void RTCVideoDecoderFactoryTv::Initialize(media::DemuxerHost* /*host*/, |
197 const media::PipelineStatusCB& cb, | 197 const media::PipelineStatusCB& cb, |
198 bool /*enable_text_tracks*/) { | 198 bool /*enable_text_tracks*/) { |
199 base::AutoLock lock(lock_); | 199 base::AutoLock lock(lock_); |
200 init_cb_ = media::BindToLoop(base::MessageLoopProxy::current(), cb); | 200 init_cb_ = media::BindToCurrentLoop(cb); |
201 if (stream_) | 201 if (stream_) |
202 base::ResetAndReturn(&init_cb_).Run(media::PIPELINE_OK); | 202 base::ResetAndReturn(&init_cb_).Run(media::PIPELINE_OK); |
203 } | 203 } |
204 | 204 |
205 void RTCVideoDecoderFactoryTv::Seek(base::TimeDelta time, | 205 void RTCVideoDecoderFactoryTv::Seek(base::TimeDelta time, |
206 const media::PipelineStatusCB& status_cb) { | 206 const media::PipelineStatusCB& status_cb) { |
207 DCHECK(!status_cb.is_null()); | 207 DCHECK(!status_cb.is_null()); |
208 status_cb.Run(media::PIPELINE_OK); | 208 status_cb.Run(media::PIPELINE_OK); |
209 } | 209 } |
210 | 210 |
(...skipping 26 matching lines...) Expand all Loading... |
237 | 237 |
238 void RTCVideoDecoderFactoryTv::QueueBuffer( | 238 void RTCVideoDecoderFactoryTv::QueueBuffer( |
239 scoped_refptr<media::DecoderBuffer> buffer, | 239 scoped_refptr<media::DecoderBuffer> buffer, |
240 const gfx::Size& new_size) { | 240 const gfx::Size& new_size) { |
241 base::AutoLock lock(lock_); | 241 base::AutoLock lock(lock_); |
242 DCHECK(stream_); | 242 DCHECK(stream_); |
243 stream_->QueueBuffer(buffer, new_size); | 243 stream_->QueueBuffer(buffer, new_size); |
244 } | 244 } |
245 | 245 |
246 } // namespace content | 246 } // namespace content |
OLD | NEW |