| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (!decoder) | 37 if (!decoder) |
| 38 return nullptr; | 38 return nullptr; |
| 39 decoder->SetDelegate(delegate); | 39 decoder->SetDelegate(delegate); |
| 40 | 40 |
| 41 AudioConfig audio_config; | 41 AudioConfig audio_config; |
| 42 audio_config.codec = kCodecPCM; | 42 audio_config.codec = kCodecPCM; |
| 43 audio_config.sample_format = kSampleFormatS16; | 43 audio_config.sample_format = kSampleFormatS16; |
| 44 audio_config.bytes_per_channel = audio_params.bits_per_sample() / 8; | 44 audio_config.bytes_per_channel = audio_params.bits_per_sample() / 8; |
| 45 audio_config.channel_number = audio_params.channels(); | 45 audio_config.channel_number = audio_params.channels(); |
| 46 audio_config.samples_per_second = audio_params.sample_rate(); | 46 audio_config.samples_per_second = audio_params.sample_rate(); |
| 47 audio_config.is_encrypted = false; | |
| 48 | 47 |
| 49 if (!decoder->SetConfig(audio_config)) | 48 if (!decoder->SetConfig(audio_config)) |
| 50 return nullptr; | 49 return nullptr; |
| 51 | 50 |
| 52 if (!backend->Initialize()) | 51 if (!backend->Initialize()) |
| 53 return nullptr; | 52 return nullptr; |
| 54 | 53 |
| 55 return decoder; | 54 return decoder; |
| 56 } | 55 } |
| 57 | 56 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 audio_task_runner_->PostDelayedTask( | 375 audio_task_runner_->PostDelayedTask( |
| 377 FROM_HERE, | 376 FROM_HERE, |
| 378 base::Bind(&CastAudioOutputStream::PushBuffer, | 377 base::Bind(&CastAudioOutputStream::PushBuffer, |
| 379 weak_factory_.GetWeakPtr()), | 378 weak_factory_.GetWeakPtr()), |
| 380 delay); | 379 delay); |
| 381 push_in_progress_ = true; | 380 push_in_progress_ = true; |
| 382 } | 381 } |
| 383 | 382 |
| 384 } // namespace media | 383 } // namespace media |
| 385 } // namespace chromecast | 384 } // namespace chromecast |
| OLD | NEW |