| 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/cma/backend/alsa/stream_mixer_alsa_input.h" | 5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h" | 9 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h" |
| 10 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h" | 10 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h" |
| 11 | 11 |
| 12 namespace chromecast { | 12 namespace chromecast { |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 StreamMixerAlsaInput::StreamMixerAlsaInput(Delegate* delegate, | 15 StreamMixerAlsaInput::StreamMixerAlsaInput(Delegate* delegate, |
| 16 int samples_per_second, | 16 int samples_per_second, |
| 17 bool primary) { | 17 bool primary) { |
| 18 scoped_ptr<StreamMixerAlsaInputImpl> impl(new StreamMixerAlsaInputImpl( | 18 std::unique_ptr<StreamMixerAlsaInputImpl> impl(new StreamMixerAlsaInputImpl( |
| 19 delegate, samples_per_second, primary, StreamMixerAlsa::Get())); | 19 delegate, samples_per_second, primary, StreamMixerAlsa::Get())); |
| 20 impl_ = impl.get(); // Store a pointer to the impl, but the mixer owns it. | 20 impl_ = impl.get(); // Store a pointer to the impl, but the mixer owns it. |
| 21 StreamMixerAlsa::Get()->AddInput(std::move(impl)); | 21 StreamMixerAlsa::Get()->AddInput(std::move(impl)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 StreamMixerAlsaInput::~StreamMixerAlsaInput() { | 24 StreamMixerAlsaInput::~StreamMixerAlsaInput() { |
| 25 DCHECK(thread_checker_.CalledOnValidThread()); | 25 DCHECK(thread_checker_.CalledOnValidThread()); |
| 26 impl_->PreventDelegateCalls(); | 26 impl_->PreventDelegateCalls(); |
| 27 StreamMixerAlsa::Get()->RemoveInput(impl_); | 27 StreamMixerAlsa::Get()->RemoveInput(impl_); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void StreamMixerAlsaInput::WritePcm( | 30 void StreamMixerAlsaInput::WritePcm( |
| 31 const scoped_refptr<DecoderBufferBase>& data) { | 31 const scoped_refptr<DecoderBufferBase>& data) { |
| 32 DCHECK(thread_checker_.CalledOnValidThread()); | 32 DCHECK(thread_checker_.CalledOnValidThread()); |
| 33 impl_->WritePcm(data); | 33 impl_->WritePcm(data); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void StreamMixerAlsaInput::SetPaused(bool paused) { | 36 void StreamMixerAlsaInput::SetPaused(bool paused) { |
| 37 DCHECK(thread_checker_.CalledOnValidThread()); | 37 DCHECK(thread_checker_.CalledOnValidThread()); |
| 38 impl_->SetPaused(paused); | 38 impl_->SetPaused(paused); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void StreamMixerAlsaInput::SetVolumeMultiplier(float multiplier) { | 41 void StreamMixerAlsaInput::SetVolumeMultiplier(float multiplier) { |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); | 42 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 impl_->SetVolumeMultiplier(multiplier); | 43 impl_->SetVolumeMultiplier(multiplier); |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace media | 46 } // namespace media |
| 47 } // namespace chromecast | 47 } // namespace chromecast |
| OLD | NEW |