| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/audio/cast_audio_output_stream.h" | 5 #include "chromecast/media/audio/cast_audio_output_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "chromecast/base/metrics/cast_metrics_helper.h" | 12 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 13 #include "chromecast/base/task_runner_impl.h" | 13 #include "chromecast/base/task_runner_impl.h" |
| 14 #include "chromecast/media/audio/cast_audio_manager.h" | 14 #include "chromecast/media/audio/cast_audio_manager.h" |
| 15 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" | 15 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" |
| 16 #include "chromecast/public/media/decoder_config.h" | 16 #include "chromecast/public/media/decoder_config.h" |
| 17 #include "chromecast/public/media/media_pipeline_backend.h" | 17 #include "chromecast/public/media/media_pipeline_backend.h" |
| 18 #include "chromecast/public/media/media_pipeline_device_params.h" | 18 #include "chromecast/public/media/media_pipeline_device_params.h" |
| 19 #include "chromecast/public/volume_control.h" |
| 20 #include "media/audio/audio_device_description.h" |
| 19 #include "media/base/decoder_buffer.h" | 21 #include "media/base/decoder_buffer.h" |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 const int kMaxQueuedDataMs = 1000; | 24 const int kMaxQueuedDataMs = 1000; |
| 23 } // namespace | 25 } // namespace |
| 24 | 26 |
| 25 namespace chromecast { | 27 namespace chromecast { |
| 26 namespace media { | 28 namespace media { |
| 27 | 29 |
| 28 // Backend represents a MediaPipelineBackend adapter. | 30 // Backend represents a MediaPipelineBackend adapter. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 bool Open(const ::media::AudioParameters& audio_params, | 43 bool Open(const ::media::AudioParameters& audio_params, |
| 42 CastAudioManager* audio_manager) { | 44 CastAudioManager* audio_manager) { |
| 43 DCHECK(thread_checker_.CalledOnValidThread()); | 45 DCHECK(thread_checker_.CalledOnValidThread()); |
| 44 DCHECK(audio_manager); | 46 DCHECK(audio_manager); |
| 45 DCHECK(backend_ == nullptr); | 47 DCHECK(backend_ == nullptr); |
| 46 | 48 |
| 47 backend_task_runner_.reset(new TaskRunnerImpl()); | 49 backend_task_runner_.reset(new TaskRunnerImpl()); |
| 48 MediaPipelineDeviceParams device_params( | 50 MediaPipelineDeviceParams device_params( |
| 49 MediaPipelineDeviceParams::kModeIgnorePts, | 51 MediaPipelineDeviceParams::kModeIgnorePts, |
| 50 MediaPipelineDeviceParams::kAudioStreamSoundEffects, | 52 MediaPipelineDeviceParams::kAudioStreamSoundEffects, |
| 51 backend_task_runner_.get()); | 53 backend_task_runner_.get(), AudioContentType::kMedia, |
| 54 ::media::AudioDeviceDescription::kDefaultDeviceId); |
| 52 backend_ = audio_manager->CreateMediaPipelineBackend(device_params); | 55 backend_ = audio_manager->CreateMediaPipelineBackend(device_params); |
| 53 if (!backend_) | 56 if (!backend_) |
| 54 return false; | 57 return false; |
| 55 | 58 |
| 56 decoder_ = backend_->CreateAudioDecoder(); | 59 decoder_ = backend_->CreateAudioDecoder(); |
| 57 if (!decoder_) | 60 if (!decoder_) |
| 58 return false; | 61 return false; |
| 59 decoder_->SetDelegate(this); | 62 decoder_->SetDelegate(this); |
| 60 | 63 |
| 61 AudioConfig audio_config; | 64 AudioConfig audio_config; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 327 |
| 325 audio_manager_->GetTaskRunner()->PostDelayedTask( | 328 audio_manager_->GetTaskRunner()->PostDelayedTask( |
| 326 FROM_HERE, base::Bind(&CastAudioOutputStream::PushBuffer, | 329 FROM_HERE, base::Bind(&CastAudioOutputStream::PushBuffer, |
| 327 weak_factory_.GetWeakPtr()), | 330 weak_factory_.GetWeakPtr()), |
| 328 delay); | 331 delay); |
| 329 push_in_progress_ = true; | 332 push_in_progress_ = true; |
| 330 } | 333 } |
| 331 | 334 |
| 332 } // namespace media | 335 } // namespace media |
| 333 } // namespace chromecast | 336 } // namespace chromecast |
| OLD | NEW |