Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input.cc

Issue 2738873002: [Chromecast] Implement new volume control API (Closed)
Patch Set: no need for ALSA volume control Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 const std::string& device_id) { 18 const std::string& device_id,
19 std::unique_ptr<StreamMixerAlsaInputImpl> impl( 19 AudioContentType content_type) {
20 new StreamMixerAlsaInputImpl(delegate, samples_per_second, primary, 20 std::unique_ptr<StreamMixerAlsaInputImpl> impl(new StreamMixerAlsaInputImpl(
21 device_id, StreamMixerAlsa::Get())); 21 delegate, samples_per_second, primary, device_id, content_type,
22 StreamMixerAlsa::Get()));
22 impl_ = impl.get(); // Store a pointer to the impl, but the mixer owns it. 23 impl_ = impl.get(); // Store a pointer to the impl, but the mixer owns it.
23 StreamMixerAlsa::Get()->AddInput(std::move(impl)); 24 StreamMixerAlsa::Get()->AddInput(std::move(impl));
24 } 25 }
25 26
26 StreamMixerAlsaInput::~StreamMixerAlsaInput() { 27 StreamMixerAlsaInput::~StreamMixerAlsaInput() {
27 DCHECK(thread_checker_.CalledOnValidThread()); 28 DCHECK(thread_checker_.CalledOnValidThread());
28 impl_->PreventDelegateCalls(); 29 impl_->PreventDelegateCalls();
29 StreamMixerAlsa::Get()->RemoveInput(impl_); 30 StreamMixerAlsa::Get()->RemoveInput(impl_);
30 } 31 }
31 32
32 void StreamMixerAlsaInput::WritePcm( 33 void StreamMixerAlsaInput::WritePcm(
33 const scoped_refptr<DecoderBufferBase>& data) { 34 const scoped_refptr<DecoderBufferBase>& data) {
34 DCHECK(thread_checker_.CalledOnValidThread()); 35 DCHECK(thread_checker_.CalledOnValidThread());
35 impl_->WritePcm(data); 36 impl_->WritePcm(data);
36 } 37 }
37 38
38 void StreamMixerAlsaInput::SetPaused(bool paused) { 39 void StreamMixerAlsaInput::SetPaused(bool paused) {
39 DCHECK(thread_checker_.CalledOnValidThread()); 40 DCHECK(thread_checker_.CalledOnValidThread());
40 impl_->SetPaused(paused); 41 impl_->SetPaused(paused);
41 } 42 }
42 43
43 void StreamMixerAlsaInput::SetVolumeMultiplier(float multiplier) { 44 void StreamMixerAlsaInput::SetVolumeMultiplier(float multiplier) {
44 DCHECK(thread_checker_.CalledOnValidThread()); 45 DCHECK(thread_checker_.CalledOnValidThread());
45 impl_->SetVolumeMultiplier(multiplier); 46 impl_->SetVolumeMultiplier(multiplier);
46 } 47 }
47 48
48 } // namespace media 49 } // namespace media
49 } // namespace chromecast 50 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698