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

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

Issue 328493003: Pass the elapsed time from VoE to WebRtcAudioRenderer as the current time for the audio/video eleme… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 void WebRtcAudioRenderer::SetVolume(float volume) { 444 void WebRtcAudioRenderer::SetVolume(float volume) {
445 DCHECK(thread_checker_.CalledOnValidThread()); 445 DCHECK(thread_checker_.CalledOnValidThread());
446 DCHECK(volume >= 0.0f && volume <= 1.0f); 446 DCHECK(volume >= 0.0f && volume <= 1.0f);
447 447
448 playing_state_.set_volume(volume); 448 playing_state_.set_volume(volume);
449 OnPlayStateChanged(media_stream_, &playing_state_); 449 OnPlayStateChanged(media_stream_, &playing_state_);
450 } 450 }
451 451
452 base::TimeDelta WebRtcAudioRenderer::GetCurrentRenderTime() const { 452 base::TimeDelta WebRtcAudioRenderer::GetCurrentRenderTime() const {
453 return base::TimeDelta(); 453 DCHECK(thread_checker_.CalledOnValidThread());
454 base::AutoLock auto_lock(lock_);
455 return current_time_;
454 } 456 }
455 457
456 bool WebRtcAudioRenderer::IsLocalRenderer() const { 458 bool WebRtcAudioRenderer::IsLocalRenderer() const {
457 return false; 459 return false;
458 } 460 }
459 461
460 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, 462 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus,
461 int audio_delay_milliseconds) { 463 int audio_delay_milliseconds) {
462 base::AutoLock auto_lock(lock_); 464 base::AutoLock auto_lock(lock_);
463 if (!source_) 465 if (!source_)
(...skipping 24 matching lines...) Expand all
488 << fifo_frame_delay << ", " 490 << fifo_frame_delay << ", "
489 << audio_bus->frames() << ")"; 491 << audio_bus->frames() << ")";
490 492
491 int output_delay_milliseconds = audio_delay_milliseconds_; 493 int output_delay_milliseconds = audio_delay_milliseconds_;
492 output_delay_milliseconds += fifo_delay_milliseconds_; 494 output_delay_milliseconds += fifo_delay_milliseconds_;
493 DVLOG(2) << "output_delay_milliseconds: " << output_delay_milliseconds; 495 DVLOG(2) << "output_delay_milliseconds: " << output_delay_milliseconds;
494 496
495 // We need to keep render data for the |source_| regardless of |state_|, 497 // We need to keep render data for the |source_| regardless of |state_|,
496 // otherwise the data will be buffered up inside |source_|. 498 // otherwise the data will be buffered up inside |source_|.
497 source_->RenderData(audio_bus, sink_params_.sample_rate(), 499 source_->RenderData(audio_bus, sink_params_.sample_rate(),
498 output_delay_milliseconds); 500 output_delay_milliseconds,
501 &current_time_);
499 502
500 // Avoid filling up the audio bus if we are not playing; instead 503 // Avoid filling up the audio bus if we are not playing; instead
501 // return here and ensure that the returned value in Render() is 0. 504 // return here and ensure that the returned value in Render() is 0.
502 if (state_ != PLAYING) 505 if (state_ != PLAYING)
503 audio_bus->Zero(); 506 audio_bus->Zero();
504 } 507 }
505 508
506 void WebRtcAudioRenderer::UpdateSourceVolume( 509 void WebRtcAudioRenderer::UpdateSourceVolume(
507 webrtc::AudioSourceInterface* source) { 510 webrtc::AudioSourceInterface* source) {
508 DCHECK(thread_checker_.CalledOnValidThread()); 511 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if (RemovePlayingState(source, state)) 584 if (RemovePlayingState(source, state))
582 EnterPauseState(); 585 EnterPauseState();
583 } else if (AddPlayingState(source, state)) { 586 } else if (AddPlayingState(source, state)) {
584 EnterPlayState(); 587 EnterPlayState();
585 } 588 }
586 UpdateSourceVolume(source); 589 UpdateSourceVolume(source);
587 } 590 }
588 } 591 }
589 592
590 } // namespace content 593 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_renderer.h ('k') | content/renderer/media/webrtc_audio_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698