| 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 media::AudioOutputController::SyncReader* reader() const { | 59 media::AudioOutputController::SyncReader* reader() const { |
| 60 return reader_.get(); | 60 return reader_.get(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 // media::AudioOutputController::EventHandler implementation. | 64 // media::AudioOutputController::EventHandler implementation. |
| 65 virtual void OnCreated() OVERRIDE; | 65 virtual void OnCreated() OVERRIDE; |
| 66 virtual void OnPlaying() OVERRIDE; | 66 virtual void OnPlaying() OVERRIDE; |
| 67 virtual void OnAudible(bool is_audible) OVERRIDE; | 67 virtual void OnAudible(bool is_audible) OVERRIDE; |
| 68 virtual void OnPaused() OVERRIDE; | 68 virtual void OnPaused() OVERRIDE; |
| 69 virtual void OnError(int error_code) OVERRIDE; | 69 virtual void OnError() OVERRIDE; |
| 70 virtual void OnDeviceChange(int new_buffer_size, int new_sample_rate) | 70 virtual void OnDeviceChange(int new_buffer_size, int new_sample_rate) |
| 71 OVERRIDE; | 71 OVERRIDE; |
| 72 | 72 |
| 73 AudioRendererHost* const host_; | 73 AudioRendererHost* const host_; |
| 74 const int stream_id_; | 74 const int stream_id_; |
| 75 | 75 |
| 76 // The routing ID of the source render view. | 76 // The routing ID of the source render view. |
| 77 int render_view_id_; | 77 int render_view_id_; |
| 78 | 78 |
| 79 // The AudioOutputController that manages the audio stream. | 79 // The AudioOutputController that manages the audio stream. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void AudioRendererHost::AudioEntry::OnPaused() { | 167 void AudioRendererHost::AudioEntry::OnPaused() { |
| 168 BrowserThread::PostTask( | 168 BrowserThread::PostTask( |
| 169 BrowserThread::IO, | 169 BrowserThread::IO, |
| 170 FROM_HERE, | 170 FROM_HERE, |
| 171 base::Bind( | 171 base::Bind( |
| 172 base::IgnoreResult(&AudioRendererHost::Send), host_, | 172 base::IgnoreResult(&AudioRendererHost::Send), host_, |
| 173 new AudioMsg_NotifyStreamStateChanged( | 173 new AudioMsg_NotifyStreamStateChanged( |
| 174 stream_id_, media::AudioOutputIPCDelegate::kPaused))); | 174 stream_id_, media::AudioOutputIPCDelegate::kPaused))); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void AudioRendererHost::AudioEntry::OnError(int error_code) { | 177 void AudioRendererHost::AudioEntry::OnError() { |
| 178 BrowserThread::PostTask( | 178 BrowserThread::PostTask( |
| 179 BrowserThread::IO, | 179 BrowserThread::IO, |
| 180 FROM_HERE, | 180 FROM_HERE, |
| 181 base::Bind(&AudioRendererHost::DeleteEntryOnError, host_, this)); | 181 base::Bind(&AudioRendererHost::DeleteEntryOnError, host_, this)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void AudioRendererHost::AudioEntry::OnDeviceChange(int new_buffer_size, | 184 void AudioRendererHost::AudioEntry::OnDeviceChange(int new_buffer_size, |
| 185 int new_sample_rate) { | 185 int new_sample_rate) { |
| 186 BrowserThread::PostTask( | 186 BrowserThread::PostTask( |
| 187 BrowserThread::IO, | 187 BrowserThread::IO, |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 | 473 |
| 474 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { | 474 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { |
| 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 476 | 476 |
| 477 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); | 477 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); |
| 478 return i != audio_entries_.end() ? i->second : NULL; | 478 return i != audio_entries_.end() ? i->second : NULL; |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace content | 481 } // namespace content |
| OLD | NEW |