OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/media/cma/filters/demuxer_stream_adapter.h" | 5 #include "chromecast/media/cma/filters/demuxer_stream_adapter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_to_current_loop.h" |
8 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
10 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" | 11 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" |
11 #include "chromecast/media/cma/base/cma_logging.h" | 12 #include "chromecast/media/cma/base/cma_logging.h" |
12 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" | 13 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" |
13 #include "chromecast/media/cma/base/media_task_runner.h" | 14 #include "chromecast/media/cma/base/media_task_runner.h" |
14 #include "media/base/bind_to_current_loop.h" | |
15 #include "media/base/buffers.h" | 15 #include "media/base/buffers.h" |
16 #include "media/base/decoder_buffer.h" | 16 #include "media/base/decoder_buffer.h" |
17 #include "media/base/demuxer_stream.h" | 17 #include "media/base/demuxer_stream.h" |
18 | 18 |
19 namespace chromecast { | 19 namespace chromecast { |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 class DummyMediaTaskRunner : public MediaTaskRunner { | 24 class DummyMediaTaskRunner : public MediaTaskRunner { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 max_pts_ = ::media::kNoTimestamp(); | 138 max_pts_ = ::media::kNoTimestamp(); |
139 if (media_task_runner_factory_.get()) { | 139 if (media_task_runner_factory_.get()) { |
140 media_task_runner_ = | 140 media_task_runner_ = |
141 media_task_runner_factory_->CreateMediaTaskRunner(task_runner_); | 141 media_task_runner_factory_->CreateMediaTaskRunner(task_runner_); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 void DemuxerStreamAdapter::RequestBuffer(const ReadCB& read_cb) { | 145 void DemuxerStreamAdapter::RequestBuffer(const ReadCB& read_cb) { |
146 DCHECK(thread_checker_.CalledOnValidThread()); | 146 DCHECK(thread_checker_.CalledOnValidThread()); |
147 is_pending_demuxer_read_ = true; | 147 is_pending_demuxer_read_ = true; |
148 demuxer_stream_->Read(::media::BindToCurrentLoop( | 148 demuxer_stream_->Read(base::BindToCurrentLoop( |
149 base::Bind(&DemuxerStreamAdapter::OnNewBuffer, weak_this_, read_cb))); | 149 base::Bind(&DemuxerStreamAdapter::OnNewBuffer, weak_this_, read_cb))); |
150 } | 150 } |
151 | 151 |
152 void DemuxerStreamAdapter::OnNewBuffer( | 152 void DemuxerStreamAdapter::OnNewBuffer( |
153 const ReadCB& read_cb, | 153 const ReadCB& read_cb, |
154 ::media::DemuxerStream::Status status, | 154 ::media::DemuxerStream::Status status, |
155 const scoped_refptr< ::media::DecoderBuffer>& input) { | 155 const scoped_refptr< ::media::DecoderBuffer>& input) { |
156 DCHECK(thread_checker_.CalledOnValidThread()); | 156 DCHECK(thread_checker_.CalledOnValidThread()); |
157 | 157 |
158 is_pending_demuxer_read_ = false; | 158 is_pending_demuxer_read_ = false; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Back to the default audio/video config: | 198 // Back to the default audio/video config: |
199 // an invalid audio/video config means there is no config update. | 199 // an invalid audio/video config means there is no config update. |
200 if (audio_config_.IsValidConfig()) | 200 if (audio_config_.IsValidConfig()) |
201 audio_config_ = ::media::AudioDecoderConfig(); | 201 audio_config_ = ::media::AudioDecoderConfig(); |
202 if (video_config_.IsValidConfig()) | 202 if (video_config_.IsValidConfig()) |
203 video_config_ = ::media::VideoDecoderConfig(); | 203 video_config_ = ::media::VideoDecoderConfig(); |
204 } | 204 } |
205 | 205 |
206 } // namespace media | 206 } // namespace media |
207 } // namespace chromecast | 207 } // namespace chromecast |
OLD | NEW |