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

Side by Side Diff: media/base/audio_renderer_mixer_input.h

Issue 1942803002: Caching AudioOutputDevice instances in mixer manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, fix for sleep() compile error on win and a bit of cleanup around timeouts. Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // THREAD SAFETY 5 // THREAD SAFETY
6 // 6 //
7 // This class is generally not thread safe. Callers should ensure thread safety. 7 // This class is generally not thread safe. Callers should ensure thread safety.
8 // For instance, the |sink_lock_| in WebAudioSourceProvider synchronizes access 8 // For instance, the |sink_lock_| in WebAudioSourceProvider synchronizes access
9 // to this object across the main thread (for WebAudio APIs) and the 9 // to this object across the main thread (for WebAudio APIs) and the
10 // media thread (for HTMLMediaElement APIs). 10 // media thread (for HTMLMediaElement APIs).
(...skipping 25 matching lines...) Expand all
36 typedef base::Callback<AudioRendererMixer*(const AudioParameters& params, 36 typedef base::Callback<AudioRendererMixer*(const AudioParameters& params,
37 const std::string& device_id, 37 const std::string& device_id,
38 const url::Origin& security_origin, 38 const url::Origin& security_origin,
39 OutputDeviceStatus* device_status)> 39 OutputDeviceStatus* device_status)>
40 GetMixerCB; 40 GetMixerCB;
41 typedef base::Callback<void(const AudioParameters& params, 41 typedef base::Callback<void(const AudioParameters& params,
42 const std::string& device_id, 42 const std::string& device_id,
43 const url::Origin& security_origin)> 43 const url::Origin& security_origin)>
44 RemoveMixerCB; 44 RemoveMixerCB;
45 45
46 typedef base::Callback<OutputDeviceInfo(const std::string& device_id,
47 const url::Origin& security_origin)>
48 GetDeviceInfoCB;
49
46 AudioRendererMixerInput(const GetMixerCB& get_mixer_cb, 50 AudioRendererMixerInput(const GetMixerCB& get_mixer_cb,
miu 2016/05/12 21:53:06 Hmm...This is now the third callback being injecte
o1ka 2016/05/17 17:17:24 Done. (I actually was going to do that at some poi
47 const RemoveMixerCB& remove_mixer_cb, 51 const RemoveMixerCB& remove_mixer_cb,
52 const GetDeviceInfoCB& get_device_info_cb,
48 const std::string& device_id, 53 const std::string& device_id,
49 const url::Origin& security_origin); 54 const url::Origin& security_origin);
50 55
51 // SwitchableAudioRendererSink implementation. 56 // SwitchableAudioRendererSink implementation.
52 void Start() override; 57 void Start() override;
53 void Stop() override; 58 void Stop() override;
54 void Play() override; 59 void Play() override;
55 void Pause() override; 60 void Pause() override;
56 bool SetVolume(double volume) override; 61 bool SetVolume(double volume) override;
57 OutputDeviceInfo GetOutputDeviceInfo() override; 62 OutputDeviceInfo GetOutputDeviceInfo() override;
(...skipping 22 matching lines...) Expand all
80 85
81 // AudioConverter::InputCallback implementation. 86 // AudioConverter::InputCallback implementation.
82 double ProvideInput(AudioBus* audio_bus, 87 double ProvideInput(AudioBus* audio_bus,
83 base::TimeDelta buffer_delay) override; 88 base::TimeDelta buffer_delay) override;
84 89
85 // Callbacks provided during construction which allow AudioRendererMixerInput 90 // Callbacks provided during construction which allow AudioRendererMixerInput
86 // to retrieve a mixer during Initialize() and notify when it's done with it. 91 // to retrieve a mixer during Initialize() and notify when it's done with it.
87 const GetMixerCB get_mixer_cb_; 92 const GetMixerCB get_mixer_cb_;
88 const RemoveMixerCB remove_mixer_cb_; 93 const RemoveMixerCB remove_mixer_cb_;
89 94
95 // Callback to get output device information in the absence of |mixer_|.
96 const GetDeviceInfoCB get_device_info_cb_;
97
90 // AudioParameters received during Initialize(). 98 // AudioParameters received during Initialize().
91 AudioParameters params_; 99 AudioParameters params_;
92 100
93 // ID of hardware device to use 101 // ID of hardware device to use
94 std::string device_id_; 102 std::string device_id_;
95 url::Origin security_origin_; 103 url::Origin security_origin_;
96 104
97 // AudioRendererMixer provided through |get_mixer_cb_| during Initialize(), 105 // AudioRendererMixer provided through |get_mixer_cb_| during Initialize(),
98 // guaranteed to live (at least) until |remove_mixer_cb_| is called. 106 // guaranteed to live (at least) until |remove_mixer_cb_| is called.
99 AudioRendererMixer* mixer_; 107 AudioRendererMixer* mixer_;
100 108
101 // Source of audio data which is provided to the mixer. 109 // Source of audio data which is provided to the mixer.
102 AudioRendererSink::RenderCallback* callback_; 110 AudioRendererSink::RenderCallback* callback_;
103 111
104 // Error callback for handing to AudioRendererMixer. 112 // Error callback for handing to AudioRendererMixer.
105 const base::Closure error_cb_; 113 const base::Closure error_cb_;
106 114
107 // Pending switch-device callback, in case SwitchOutputDevice() is invoked 115 // Pending switch-device callback, in case SwitchOutputDevice() is invoked
108 // before Start() 116 // before Start()
109 OutputDeviceStatusCB pending_switch_callback_; 117 OutputDeviceStatusCB pending_switch_callback_;
110 std::string pending_switch_device_id_; 118 std::string pending_switch_device_id_;
111 url::Origin pending_switch_security_origin_; 119 url::Origin pending_switch_security_origin_;
112 120
113 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); 121 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput);
114 }; 122 };
115 123
116 } // namespace media 124 } // namespace media
117 125
118 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ 126 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698