| OLD | NEW |
| 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 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
| 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | |
| 10 | 9 |
| 11 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 12 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 13 #include "media/base/audio_converter.h" | 12 #include "media/base/audio_converter.h" |
| 14 #include "media/base/audio_renderer_sink.h" | 13 #include "media/base/audio_renderer_sink.h" |
| 15 | 14 |
| 16 namespace media { | 15 namespace media { |
| 17 | 16 |
| 18 // Mixes a set of AudioConverter::InputCallbacks into a single output stream | 17 // Mixes a set of AudioConverter::InputCallbacks into a single output stream |
| 19 // which is funneled into a single shared AudioRendererSink; saving a bundle | 18 // which is funneled into a single shared AudioRendererSink; saving a bundle |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 // Since errors may occur even when no inputs are playing, an error callback | 32 // Since errors may occur even when no inputs are playing, an error callback |
| 34 // must be registered separately from adding a mixer input. The same callback | 33 // must be registered separately from adding a mixer input. The same callback |
| 35 // must be given to both the functions. | 34 // must be given to both the functions. |
| 36 void AddErrorCallback(const base::Closure& error_cb); | 35 void AddErrorCallback(const base::Closure& error_cb); |
| 37 void RemoveErrorCallback(const base::Closure& error_cb); | 36 void RemoveErrorCallback(const base::Closure& error_cb); |
| 38 | 37 |
| 39 void set_pause_delay_for_testing(base::TimeDelta delay) { | 38 void set_pause_delay_for_testing(base::TimeDelta delay) { |
| 40 pause_delay_ = delay; | 39 pause_delay_ = delay; |
| 41 } | 40 } |
| 42 | 41 |
| 43 void SwitchOutputDevice(const std::string& device_id, | |
| 44 const GURL& security_origin, | |
| 45 const SwitchOutputDeviceCB& callback); | |
| 46 | |
| 47 private: | 42 private: |
| 48 // AudioRendererSink::RenderCallback implementation. | 43 // AudioRendererSink::RenderCallback implementation. |
| 49 int Render(AudioBus* audio_bus, int audio_delay_milliseconds) override; | 44 int Render(AudioBus* audio_bus, int audio_delay_milliseconds) override; |
| 50 void OnRenderError() override; | 45 void OnRenderError() override; |
| 51 | 46 |
| 52 // Output sink for this mixer. | 47 // Output sink for this mixer. |
| 53 scoped_refptr<AudioRendererSink> audio_sink_; | 48 scoped_refptr<AudioRendererSink> audio_sink_; |
| 54 | 49 |
| 55 // ---------------[ All variables below protected by |lock_| ]--------------- | 50 // ---------------[ All variables below protected by |lock_| ]--------------- |
| 56 base::Lock lock_; | 51 base::Lock lock_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 base::TimeDelta pause_delay_; | 62 base::TimeDelta pause_delay_; |
| 68 base::TimeTicks last_play_time_; | 63 base::TimeTicks last_play_time_; |
| 69 bool playing_; | 64 bool playing_; |
| 70 | 65 |
| 71 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); | 66 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); |
| 72 }; | 67 }; |
| 73 | 68 |
| 74 } // namespace media | 69 } // namespace media |
| 75 | 70 |
| 76 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 71 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
| OLD | NEW |