| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 AudioRendererSink::RenderCallback* render_callback); | 34 AudioRendererSink::RenderCallback* render_callback); |
| 35 ~AudioThreadCallback() override; | 35 ~AudioThreadCallback() override; |
| 36 | 36 |
| 37 void MapSharedMemory() override; | 37 void MapSharedMemory() override; |
| 38 | 38 |
| 39 // Called whenever we receive notifications about pending data. | 39 // Called whenever we receive notifications about pending data. |
| 40 void Process(uint32_t pending_data) override; | 40 void Process(uint32_t pending_data) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 AudioRendererSink::RenderCallback* render_callback_; | 43 AudioRendererSink::RenderCallback* render_callback_; |
| 44 scoped_ptr<AudioBus> output_bus_; | 44 std::unique_ptr<AudioBus> output_bus_; |
| 45 uint64_t callback_num_; | 45 uint64_t callback_num_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); | 47 DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 AudioOutputDevice::AudioOutputDevice( | 50 AudioOutputDevice::AudioOutputDevice( |
| 51 scoped_ptr<AudioOutputIPC> ipc, | 51 std::unique_ptr<AudioOutputIPC> ipc, |
| 52 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 52 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 53 int session_id, | 53 int session_id, |
| 54 const std::string& device_id, | 54 const std::string& device_id, |
| 55 const url::Origin& security_origin) | 55 const url::Origin& security_origin) |
| 56 : ScopedTaskRunnerObserver(io_task_runner), | 56 : ScopedTaskRunnerObserver(io_task_runner), |
| 57 callback_(NULL), | 57 callback_(NULL), |
| 58 ipc_(std::move(ipc)), | 58 ipc_(std::move(ipc)), |
| 59 state_(IDLE), | 59 state_(IDLE), |
| 60 start_on_authorized_(false), | 60 start_on_authorized_(false), |
| 61 play_on_start_(true), | 61 play_on_start_(true), |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 // Update the audio-delay measurement, inform about the number of skipped | 444 // Update the audio-delay measurement, inform about the number of skipped |
| 445 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 445 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
| 446 // the shared memory the Render() call is writing directly into the shared | 446 // the shared memory the Render() call is writing directly into the shared |
| 447 // memory. | 447 // memory. |
| 448 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 448 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
| 449 frames_skipped); | 449 frames_skipped); |
| 450 } | 450 } |
| 451 | 451 |
| 452 } // namespace media | 452 } // namespace media |
| OLD | NEW |