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 #include "media/audio/audio_output_device.h" | 5 #include "media/audio/audio_output_device.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/audio/audio_output_controller.h" | 11 #include "media/audio/audio_output_controller.h" |
12 #include "media/base/limits.h" | 12 #include "media/base/limits.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // Takes care of invoking the render callback on the audio thread. | 16 // Takes care of invoking the render callback on the audio thread. |
17 // An instance of this class is created for each capture stream in | 17 // An instance of this class is created for each capture stream in |
18 // OnStreamCreated(). | 18 // OnStreamCreated(). |
19 class AudioOutputDevice::AudioThreadCallback | 19 class AudioOutputDevice::AudioThreadCallback |
20 : public AudioDeviceThread::Callback { | 20 : public AudioDeviceThread::Callback { |
21 public: | 21 public: |
22 AudioThreadCallback(const AudioParameters& audio_parameters, | 22 AudioThreadCallback(const AudioParameters& audio_parameters, |
23 base::SharedMemoryHandle memory, | 23 base::SharedMemoryHandle memory, |
24 int memory_length, | 24 int memory_length, |
25 AudioRendererSink::RenderCallback* render_callback); | 25 AudioRendererSink::RenderCallback* render_callback); |
26 virtual ~AudioThreadCallback(); | 26 virtual ~AudioThreadCallback(); |
27 | 27 |
28 virtual void MapSharedMemory() OVERRIDE; | 28 virtual void MapSharedMemory() override; |
29 | 29 |
30 // Called whenever we receive notifications about pending data. | 30 // Called whenever we receive notifications about pending data. |
31 virtual void Process(int pending_data) OVERRIDE; | 31 virtual void Process(int pending_data) override; |
32 | 32 |
33 private: | 33 private: |
34 AudioRendererSink::RenderCallback* render_callback_; | 34 AudioRendererSink::RenderCallback* render_callback_; |
35 scoped_ptr<AudioBus> output_bus_; | 35 scoped_ptr<AudioBus> output_bus_; |
36 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); | 36 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); |
37 }; | 37 }; |
38 | 38 |
39 AudioOutputDevice::AudioOutputDevice( | 39 AudioOutputDevice::AudioOutputDevice( |
40 scoped_ptr<AudioOutputIPC> ipc, | 40 scoped_ptr<AudioOutputIPC> ipc, |
41 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 41 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 TRACE_EVENT0("audio", "AudioOutputDevice::FireRenderCallback"); | 296 TRACE_EVENT0("audio", "AudioOutputDevice::FireRenderCallback"); |
297 | 297 |
298 // Update the audio-delay measurement then ask client to render audio. Since | 298 // Update the audio-delay measurement then ask client to render audio. Since |
299 // |output_bus_| is wrapping the shared memory the Render() call is writing | 299 // |output_bus_| is wrapping the shared memory the Render() call is writing |
300 // directly into the shared memory. | 300 // directly into the shared memory. |
301 render_callback_->Render(output_bus_.get(), audio_delay_milliseconds); | 301 render_callback_->Render(output_bus_.get(), audio_delay_milliseconds); |
302 } | 302 } |
303 | 303 |
304 } // namespace media. | 304 } // namespace media. |
OLD | NEW |