| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "media/base/audio_converter.h" | 17 #include "media/base/audio_converter.h" |
| 18 #include "media/base/audio_renderer_sink.h" | 18 #include "media/base/audio_renderer_sink.h" |
| 19 #include "media/base/loopback_audio_converter.h" | 19 #include "media/base/loopback_audio_converter.h" |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 // Mixes a set of AudioConverter::InputCallbacks into a single output stream | 23 // Mixes a set of AudioConverter::InputCallbacks into a single output stream |
| 24 // which is funneled into a single shared AudioRendererSink; saving a bundle | 24 // which is funneled into a single shared AudioRendererSink; saving a bundle |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 void RemoveErrorCallback(const base::Closure& error_cb); | 43 void RemoveErrorCallback(const base::Closure& error_cb); |
| 44 | 44 |
| 45 void set_pause_delay_for_testing(base::TimeDelta delay) { | 45 void set_pause_delay_for_testing(base::TimeDelta delay) { |
| 46 pause_delay_ = delay; | 46 pause_delay_ = delay; |
| 47 } | 47 } |
| 48 | 48 |
| 49 OutputDeviceInfo GetOutputDeviceInfo(); | 49 OutputDeviceInfo GetOutputDeviceInfo(); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // Maps input sample rate to the dedicated converter. | 52 // Maps input sample rate to the dedicated converter. |
| 53 typedef std::map<int, scoped_ptr<LoopbackAudioConverter>> AudioConvertersMap; | 53 using AudioConvertersMap = |
| 54 std::map<int, std::unique_ptr<LoopbackAudioConverter>>; |
| 54 | 55 |
| 55 // AudioRendererSink::RenderCallback implementation. | 56 // AudioRendererSink::RenderCallback implementation. |
| 56 int Render(AudioBus* audio_bus, | 57 int Render(AudioBus* audio_bus, |
| 57 uint32_t frames_delayed, | 58 uint32_t frames_delayed, |
| 58 uint32_t frames_skipped) override; | 59 uint32_t frames_skipped) override; |
| 59 void OnRenderError() override; | 60 void OnRenderError() override; |
| 60 | 61 |
| 61 bool is_master_sample_rate(int sample_rate) { | 62 bool is_master_sample_rate(int sample_rate) { |
| 62 return sample_rate == output_params_.sample_rate(); | 63 return sample_rate == output_params_.sample_rate(); |
| 63 } | 64 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 89 base::TimeDelta pause_delay_; | 90 base::TimeDelta pause_delay_; |
| 90 base::TimeTicks last_play_time_; | 91 base::TimeTicks last_play_time_; |
| 91 bool playing_; | 92 bool playing_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); | 94 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace media | 97 } // namespace media |
| 97 | 98 |
| 98 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ | 99 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_H_ |
| OLD | NEW |