| 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/renderer/media/webrtc_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_audio_renderer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 media::OutputDeviceStatus WebRtcAudioRenderer::GetDeviceStatus() { | 411 media::OutputDeviceStatus WebRtcAudioRenderer::GetDeviceStatus() { |
| 412 DCHECK(thread_checker_.CalledOnValidThread()); | 412 DCHECK(thread_checker_.CalledOnValidThread()); |
| 413 if (!sink_.get()) | 413 if (!sink_.get()) |
| 414 return media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; | 414 return media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; |
| 415 | 415 |
| 416 return sink_->GetDeviceStatus(); | 416 return sink_->GetDeviceStatus(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, | 419 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, |
| 420 uint32_t audio_delay_milliseconds, | 420 int audio_delay_milliseconds) { |
| 421 uint32_t frames_skipped) { | |
| 422 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread()); | 421 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread()); |
| 423 base::AutoLock auto_lock(lock_); | 422 base::AutoLock auto_lock(lock_); |
| 424 if (!source_) | 423 if (!source_) |
| 425 return 0; | 424 return 0; |
| 426 | 425 |
| 427 DVLOG(2) << "WebRtcAudioRenderer::Render()"; | 426 DVLOG(2) << "WebRtcAudioRenderer::Render()"; |
| 428 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds; | 427 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds; |
| 429 | 428 |
| 430 DCHECK_LE(audio_delay_milliseconds, static_cast<uint32_t>(INT_MAX)); | 429 audio_delay_milliseconds_ = audio_delay_milliseconds; |
| 431 audio_delay_milliseconds_ = static_cast<int>(audio_delay_milliseconds); | |
| 432 | 430 |
| 433 if (audio_fifo_) | 431 if (audio_fifo_) |
| 434 audio_fifo_->Consume(audio_bus, audio_bus->frames()); | 432 audio_fifo_->Consume(audio_bus, audio_bus->frames()); |
| 435 else | 433 else |
| 436 SourceCallback(0, audio_bus); | 434 SourceCallback(0, audio_bus); |
| 437 | 435 |
| 438 return (state_ == PLAYING) ? audio_bus->frames() : 0; | 436 return (state_ == PLAYING) ? audio_bus->frames() : 0; |
| 439 } | 437 } |
| 440 | 438 |
| 441 void WebRtcAudioRenderer::OnRenderError() { | 439 void WebRtcAudioRenderer::OnRenderError() { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 sink_params_ = new_sink_params; | 648 sink_params_ = new_sink_params; |
| 651 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; | 649 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; |
| 652 if (new_audio_fifo.get()) | 650 if (new_audio_fifo.get()) |
| 653 audio_fifo_ = new_audio_fifo.Pass(); | 651 audio_fifo_ = new_audio_fifo.Pass(); |
| 654 } | 652 } |
| 655 | 653 |
| 656 sink_->Initialize(new_sink_params, this); | 654 sink_->Initialize(new_sink_params, this); |
| 657 } | 655 } |
| 658 | 656 |
| 659 } // namespace content | 657 } // namespace content |
| OLD | NEW |