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

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

Issue 1538563002: 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: Code review fix. git cl format. Rebase. 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 media::OutputDeviceStatus WebRtcAudioRenderer::GetDeviceStatus() { 412 media::OutputDeviceStatus WebRtcAudioRenderer::GetDeviceStatus() {
413 DCHECK(thread_checker_.CalledOnValidThread()); 413 DCHECK(thread_checker_.CalledOnValidThread());
414 if (!sink_.get()) 414 if (!sink_.get())
415 return media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; 415 return media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL;
416 416
417 return sink_->GetDeviceStatus(); 417 return sink_->GetDeviceStatus();
418 } 418 }
419 419
420 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, 420 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus,
421 int audio_delay_milliseconds) { 421 uint32_t audio_delay_milliseconds,
422 uint32_t frames_skipped) {
422 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread()); 423 DCHECK(audio_renderer_thread_checker_.CalledOnValidThread());
423 base::AutoLock auto_lock(lock_); 424 base::AutoLock auto_lock(lock_);
424 if (!source_) 425 if (!source_)
425 return 0; 426 return 0;
426 427
427 DVLOG(2) << "WebRtcAudioRenderer::Render()"; 428 DVLOG(2) << "WebRtcAudioRenderer::Render()";
428 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds; 429 DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds;
429 430
430 audio_delay_milliseconds_ = audio_delay_milliseconds; 431 DCHECK_LE(audio_delay_milliseconds, static_cast<uint32_t>(INT_MAX));
432 audio_delay_milliseconds_ = static_cast<int>(audio_delay_milliseconds);
431 433
432 if (audio_fifo_) 434 if (audio_fifo_)
433 audio_fifo_->Consume(audio_bus, audio_bus->frames()); 435 audio_fifo_->Consume(audio_bus, audio_bus->frames());
434 else 436 else
435 SourceCallback(0, audio_bus); 437 SourceCallback(0, audio_bus);
436 438
437 return (state_ == PLAYING) ? audio_bus->frames() : 0; 439 return (state_ == PLAYING) ? audio_bus->frames() : 0;
438 } 440 }
439 441
440 void WebRtcAudioRenderer::OnRenderError() { 442 void WebRtcAudioRenderer::OnRenderError() {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 sink_params_ = new_sink_params; 651 sink_params_ = new_sink_params;
650 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; 652 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds;
651 if (new_audio_fifo.get()) 653 if (new_audio_fifo.get())
652 audio_fifo_ = new_audio_fifo.Pass(); 654 audio_fifo_ = new_audio_fifo.Pass();
653 } 655 }
654 656
655 sink_->Initialize(new_sink_params, this); 657 sink_->Initialize(new_sink_params, this);
656 } 658 }
657 659
658 } // namespace content 660 } // 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