| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 : public media::AudioOutputController::EventHandler { | 35 : public media::AudioOutputController::EventHandler { |
| 36 public: | 36 public: |
| 37 AudioEntry(AudioRendererHost* host, | 37 AudioEntry(AudioRendererHost* host, |
| 38 int stream_id, | 38 int stream_id, |
| 39 int render_view_id, | 39 int render_view_id, |
| 40 int render_frame_id, | 40 int render_frame_id, |
| 41 const media::AudioParameters& params, | 41 const media::AudioParameters& params, |
| 42 const std::string& output_device_id, | 42 const std::string& output_device_id, |
| 43 scoped_ptr<base::SharedMemory> shared_memory, | 43 scoped_ptr<base::SharedMemory> shared_memory, |
| 44 scoped_ptr<media::AudioOutputController::SyncReader> reader); | 44 scoped_ptr<media::AudioOutputController::SyncReader> reader); |
| 45 virtual ~AudioEntry(); | 45 ~AudioEntry() override; |
| 46 | 46 |
| 47 int stream_id() const { | 47 int stream_id() const { |
| 48 return stream_id_; | 48 return stream_id_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 int render_view_id() const { | 51 int render_view_id() const { |
| 52 return render_view_id_; | 52 return render_view_id_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 int render_frame_id() const { return render_frame_id_; } | 55 int render_frame_id() const { return render_frame_id_; } |
| 56 | 56 |
| 57 media::AudioOutputController* controller() const { return controller_.get(); } | 57 media::AudioOutputController* controller() const { return controller_.get(); } |
| 58 | 58 |
| 59 base::SharedMemory* shared_memory() { | 59 base::SharedMemory* shared_memory() { |
| 60 return shared_memory_.get(); | 60 return shared_memory_.get(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 media::AudioOutputController::SyncReader* reader() const { | 63 media::AudioOutputController::SyncReader* reader() const { |
| 64 return reader_.get(); | 64 return reader_.get(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool playing() const { return playing_; } | 67 bool playing() const { return playing_; } |
| 68 void set_playing(bool playing) { playing_ = playing; } | 68 void set_playing(bool playing) { playing_ = playing; } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // media::AudioOutputController::EventHandler implementation. | 71 // media::AudioOutputController::EventHandler implementation. |
| 72 virtual void OnCreated() override; | 72 void OnCreated() override; |
| 73 virtual void OnPlaying() override; | 73 void OnPlaying() override; |
| 74 virtual void OnPaused() override; | 74 void OnPaused() override; |
| 75 virtual void OnError() override; | 75 void OnError() override; |
| 76 virtual void OnDeviceChange(int new_buffer_size, int new_sample_rate) | 76 void OnDeviceChange(int new_buffer_size, int new_sample_rate) override; |
| 77 override; | |
| 78 | 77 |
| 79 AudioRendererHost* const host_; | 78 AudioRendererHost* const host_; |
| 80 const int stream_id_; | 79 const int stream_id_; |
| 81 | 80 |
| 82 // The routing ID of the source render view/frame. | 81 // The routing ID of the source render view/frame. |
| 83 const int render_view_id_; | 82 const int render_view_id_; |
| 84 const int render_frame_id_; | 83 const int render_frame_id_; |
| 85 | 84 |
| 86 // Shared memory for transmission of the audio data. Used by |reader_|. | 85 // Shared memory for transmission of the audio data. Used by |reader_|. |
| 87 const scoped_ptr<base::SharedMemory> shared_memory_; | 86 const scoped_ptr<base::SharedMemory> shared_memory_; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 it != audio_entries_.end(); | 505 it != audio_entries_.end(); |
| 507 ++it) { | 506 ++it) { |
| 508 AudioEntry* entry = it->second; | 507 AudioEntry* entry = it->second; |
| 509 if (entry->render_view_id() == render_view_id && entry->playing()) | 508 if (entry->render_view_id() == render_view_id && entry->playing()) |
| 510 return true; | 509 return true; |
| 511 } | 510 } |
| 512 return false; | 511 return false; |
| 513 } | 512 } |
| 514 | 513 |
| 515 } // namespace content | 514 } // namespace content |
| OLD | NEW |