Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: content/renderer/media/webrtc_audio_renderer.cc

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix in Windows unit test. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 int audio_delay_milliseconds) { 420 uint32_t audio_delay_milliseconds,
421 uint32_t frames_skipped) {
421 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread()); 422 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread());
422 base::AutoLock auto_lock(lock_); 423 base::AutoLock auto_lock(lock_);
423 if (!source_) 424 if (!source_)
424 return 0; 425 return 0;
425 426
426 DVLOG(2) << "WebRtcAudioRenderer::Render()"; 427 DVLOG(2) << "WebRtcAudioRenderer::Render()";
427 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds; 428 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds;
428 429
429 audio_delay_milliseconds_ = audio_delay_milliseconds; 430 DCHECK_LE(audio_delay_milliseconds, static_cast<uint32_t>(INT_MAX));
431 audio_delay_milliseconds_ = static_cast<int>(audio_delay_milliseconds);
430 432
431 if (audio_fifo_) 433 if (audio_fifo_)
432 audio_fifo_->Consume(audio_bus, audio_bus->frames()); 434 audio_fifo_->Consume(audio_bus, audio_bus->frames());
433 else 435 else
434 SourceCallback(0, audio_bus); 436 SourceCallback(0, audio_bus);
435 437
436 return (state_ == PLAYING) ? audio_bus->frames() : 0; 438 return (state_ == PLAYING) ? audio_bus->frames() : 0;
437 } 439 }
438 440
439 void WebRtcAudioRenderer::OnRenderError() { 441 void WebRtcAudioRenderer::OnRenderError() {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 sink_params_ = new_sink_params; 650 sink_params_ = new_sink_params;
649 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; 651 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds;
650 if (new_audio_fifo.get()) 652 if (new_audio_fifo.get())
651 audio_fifo_ = new_audio_fifo.Pass(); 653 audio_fifo_ = new_audio_fifo.Pass();
652 } 654 }
653 655
654 sink_->Initialize(new_sink_params, this); 656 sink_->Initialize(new_sink_params, this);
655 } 657 }
656 658
657 } // namespace content 659 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_renderer.h ('k') | content/renderer/media/webrtc_local_audio_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698