| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 void AudioRendererHost::DoNotifyStreamStateChanged(int stream_id, | 262 void AudioRendererHost::DoNotifyStreamStateChanged(int stream_id, |
| 263 bool is_playing) { | 263 bool is_playing) { |
| 264 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 264 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 265 | 265 |
| 266 AudioEntry* const entry = LookupById(stream_id); | 266 AudioEntry* const entry = LookupById(stream_id); |
| 267 if (!entry) | 267 if (!entry) |
| 268 return; | 268 return; |
| 269 | 269 |
| 270 Send(new AudioMsg_NotifyStreamStateChanged( | 270 Send(new AudioMsg_NotifyStreamStateChanged( |
| 271 stream_id, | 271 stream_id, |
| 272 is_playing ? media::AudioOutputIPCDelegate::kPlaying | 272 is_playing ? media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING |
| 273 : media::AudioOutputIPCDelegate::kPaused)); | 273 : media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_PAUSED)); |
| 274 | 274 |
| 275 if (is_playing) { | 275 if (is_playing) { |
| 276 AudioStreamMonitor::StartMonitoringStream( | 276 AudioStreamMonitor::StartMonitoringStream( |
| 277 render_process_id_, | 277 render_process_id_, |
| 278 entry->render_frame_id(), | 278 entry->render_frame_id(), |
| 279 entry->stream_id(), | 279 entry->stream_id(), |
| 280 base::Bind(&media::AudioOutputController::ReadCurrentPowerAndClip, | 280 base::Bind(&media::AudioOutputController::ReadCurrentPowerAndClip, |
| 281 entry->controller())); | 281 entry->controller())); |
| 282 } else { | 282 } else { |
| 283 AudioStreamMonitor::StopMonitoringStream( | 283 AudioStreamMonitor::StopMonitoringStream( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 417 |
| 418 // Make sure the volume is valid. | 418 // Make sure the volume is valid. |
| 419 if (volume < 0 || volume > 1.0) | 419 if (volume < 0 || volume > 1.0) |
| 420 return; | 420 return; |
| 421 entry->controller()->SetVolume(volume); | 421 entry->controller()->SetVolume(volume); |
| 422 audio_log_->OnSetVolume(stream_id, volume); | 422 audio_log_->OnSetVolume(stream_id, volume); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void AudioRendererHost::SendErrorMessage(int stream_id) { | 425 void AudioRendererHost::SendErrorMessage(int stream_id) { |
| 426 Send(new AudioMsg_NotifyStreamStateChanged( | 426 Send(new AudioMsg_NotifyStreamStateChanged( |
| 427 stream_id, media::AudioOutputIPCDelegate::kError)); | 427 stream_id, media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR)); |
| 428 } | 428 } |
| 429 | 429 |
| 430 void AudioRendererHost::OnCloseStream(int stream_id) { | 430 void AudioRendererHost::OnCloseStream(int stream_id) { |
| 431 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 431 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 432 | 432 |
| 433 // Prevent oustanding callbacks from attempting to close/delete the same | 433 // Prevent oustanding callbacks from attempting to close/delete the same |
| 434 // AudioEntry twice. | 434 // AudioEntry twice. |
| 435 AudioEntryMap::iterator i = audio_entries_.find(stream_id); | 435 AudioEntryMap::iterator i = audio_entries_.find(stream_id); |
| 436 if (i == audio_entries_.end()) | 436 if (i == audio_entries_.end()) |
| 437 return; | 437 return; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 it != audio_entries_.end(); | 513 it != audio_entries_.end(); |
| 514 ++it) { | 514 ++it) { |
| 515 AudioEntry* entry = it->second; | 515 AudioEntry* entry = it->second; |
| 516 if (entry->render_frame_id() == render_frame_id && entry->playing()) | 516 if (entry->render_frame_id() == render_frame_id && entry->playing()) |
| 517 return true; | 517 return true; |
| 518 } | 518 } |
| 519 return false; | 519 return false; |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace content | 522 } // namespace content |
| OLD | NEW |