| 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 "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 media::AudioOutputController::SyncReader* reader() const { | 61 media::AudioOutputController::SyncReader* reader() const { |
| 62 return reader_.get(); | 62 return reader_.get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool playing() const { return playing_; } | 65 bool playing() const { return playing_; } |
| 66 void set_playing(bool playing) { playing_ = playing; } | 66 void set_playing(bool playing) { playing_ = playing; } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // media::AudioOutputController::EventHandler implementation. | 69 // media::AudioOutputController::EventHandler implementation. |
| 70 virtual void OnCreated() OVERRIDE; | 70 virtual void OnCreated() override; |
| 71 virtual void OnPlaying() OVERRIDE; | 71 virtual void OnPlaying() override; |
| 72 virtual void OnPaused() OVERRIDE; | 72 virtual void OnPaused() override; |
| 73 virtual void OnError() OVERRIDE; | 73 virtual void OnError() override; |
| 74 virtual void OnDeviceChange(int new_buffer_size, int new_sample_rate) | 74 virtual void OnDeviceChange(int new_buffer_size, int new_sample_rate) |
| 75 OVERRIDE; | 75 override; |
| 76 | 76 |
| 77 AudioRendererHost* const host_; | 77 AudioRendererHost* const host_; |
| 78 const int stream_id_; | 78 const int stream_id_; |
| 79 | 79 |
| 80 // The routing ID of the source render view/frame. | 80 // The routing ID of the source render view/frame. |
| 81 const int render_view_id_; | 81 const int render_view_id_; |
| 82 const int render_frame_id_; | 82 const int render_frame_id_; |
| 83 | 83 |
| 84 // Shared memory for transmission of the audio data. Used by |reader_|. | 84 // Shared memory for transmission of the audio data. Used by |reader_|. |
| 85 const scoped_ptr<base::SharedMemory> shared_memory_; | 85 const scoped_ptr<base::SharedMemory> shared_memory_; |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 478 |
| 479 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); | 479 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); |
| 480 return i != audio_entries_.end() ? i->second : NULL; | 480 return i != audio_entries_.end() ? i->second : NULL; |
| 481 } | 481 } |
| 482 | 482 |
| 483 bool AudioRendererHost::HasActiveAudio() { | 483 bool AudioRendererHost::HasActiveAudio() { |
| 484 return !base::AtomicRefCountIsZero(&num_playing_streams_); | 484 return !base::AtomicRefCountIsZero(&num_playing_streams_); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace content | 487 } // namespace content |
| OLD | NEW |