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/ipc_streamer/av_streamer_proxy.h" | 5 #include "chromecast/media/cma/ipc_streamer/av_streamer_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
10 #include "chromecast/media/cma/base/coded_frame_provider.h" | 11 #include "chromecast/media/cma/base/coded_frame_provider.h" |
11 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 12 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
12 #include "chromecast/media/cma/ipc/media_memory_chunk.h" | 13 #include "chromecast/media/cma/ipc/media_memory_chunk.h" |
13 #include "chromecast/media/cma/ipc/media_message.h" | 14 #include "chromecast/media/cma/ipc/media_message.h" |
14 #include "chromecast/media/cma/ipc/media_message_fifo.h" | 15 #include "chromecast/media/cma/ipc/media_message_fifo.h" |
15 #include "chromecast/media/cma/ipc/media_message_type.h" | 16 #include "chromecast/media/cma/ipc/media_message_type.h" |
16 #include "chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.h" | 17 #include "chromecast/media/cma/ipc_streamer/audio_decoder_config_marshaller.h" |
17 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h" | 18 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h" |
18 #include "chromecast/media/cma/ipc_streamer/video_decoder_config_marshaller.h" | 19 #include "chromecast/media/cma/ipc_streamer/video_decoder_config_marshaller.h" |
19 | 20 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 pending_video_config_ = ::media::VideoDecoderConfig(); | 122 pending_video_config_ = ::media::VideoDecoderConfig(); |
122 } | 123 } |
123 | 124 |
124 if (pending_buffer_.get()) { | 125 if (pending_buffer_.get()) { |
125 if (!SendBuffer(pending_buffer_)) | 126 if (!SendBuffer(pending_buffer_)) |
126 return; | 127 return; |
127 pending_buffer_ = scoped_refptr<DecoderBufferBase>(); | 128 pending_buffer_ = scoped_refptr<DecoderBufferBase>(); |
128 } | 129 } |
129 | 130 |
130 pending_av_data_ = false; | 131 pending_av_data_ = false; |
131 base::MessageLoopProxy::current()->PostTask( | 132 base::ThreadTaskRunnerHandle::Get()->PostTask( |
132 FROM_HERE, | 133 FROM_HERE, |
133 base::Bind(&AvStreamerProxy::RequestBufferIfNeeded, weak_this_)); | 134 base::Bind(&AvStreamerProxy::RequestBufferIfNeeded, weak_this_)); |
134 } | 135 } |
135 | 136 |
136 bool AvStreamerProxy::SendAudioDecoderConfig( | 137 bool AvStreamerProxy::SendAudioDecoderConfig( |
137 const ::media::AudioDecoderConfig& config) { | 138 const ::media::AudioDecoderConfig& config) { |
138 // Create a dummy message to calculate first the message size. | 139 // Create a dummy message to calculate first the message size. |
139 scoped_ptr<MediaMessage> dummy_msg( | 140 scoped_ptr<MediaMessage> dummy_msg( |
140 MediaMessage::CreateDummyMessage(AudioConfigMediaMsg)); | 141 MediaMessage::CreateDummyMessage(AudioConfigMediaMsg)); |
141 AudioDecoderConfigMarshaller::Write(config, dummy_msg.get()); | 142 AudioDecoderConfigMarshaller::Write(config, dummy_msg.get()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 dummy_msg->content_size())); | 192 dummy_msg->content_size())); |
192 if (!msg) | 193 if (!msg) |
193 return false; | 194 return false; |
194 | 195 |
195 DecoderBufferBaseMarshaller::Write(buffer, msg.get()); | 196 DecoderBufferBaseMarshaller::Write(buffer, msg.get()); |
196 return true; | 197 return true; |
197 } | 198 } |
198 | 199 |
199 } // namespace media | 200 } // namespace media |
200 } // namespace chromecast | 201 } // namespace chromecast |
OLD | NEW |