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 base::AutoLock auto_lock(lock_); | 410 base::AutoLock auto_lock(lock_); |
411 if (state_ == UNINITIALIZED) | 411 if (state_ == UNINITIALIZED) |
412 return; | 412 return; |
413 | 413 |
414 DCHECK_EQ(state_, PLAYING); | 414 DCHECK_EQ(state_, PLAYING); |
415 DCHECK_GT(play_ref_count_, 0); | 415 DCHECK_GT(play_ref_count_, 0); |
416 if (!--play_ref_count_) | 416 if (!--play_ref_count_) |
417 state_ = PAUSED; | 417 state_ = PAUSED; |
418 } | 418 } |
419 | 419 |
420 void WebRtcAudioRenderer::SetCurrentRenderTime( | |
421 const base::TimeDelta& current_time) { | |
422 DCHECK(thread_checker_.CalledOnValidThread()); | |
no longer working on chromium
2014/06/10 16:21:39
it will hit the dcheck here.
Ronghua Wu (Left Chromium)
2014/06/10 17:01:07
Done.
| |
423 current_time_ = current_time; | |
424 } | |
425 | |
420 void WebRtcAudioRenderer::Stop() { | 426 void WebRtcAudioRenderer::Stop() { |
421 DVLOG(1) << "WebRtcAudioRenderer::Stop()"; | 427 DVLOG(1) << "WebRtcAudioRenderer::Stop()"; |
422 DCHECK(thread_checker_.CalledOnValidThread()); | 428 DCHECK(thread_checker_.CalledOnValidThread()); |
423 { | 429 { |
424 base::AutoLock auto_lock(lock_); | 430 base::AutoLock auto_lock(lock_); |
425 if (state_ == UNINITIALIZED) | 431 if (state_ == UNINITIALIZED) |
426 return; | 432 return; |
427 | 433 |
428 if (--start_ref_count_) | 434 if (--start_ref_count_) |
429 return; | 435 return; |
(...skipping 13 matching lines...) Expand all Loading... | |
443 | 449 |
444 void WebRtcAudioRenderer::SetVolume(float volume) { | 450 void WebRtcAudioRenderer::SetVolume(float volume) { |
445 DCHECK(thread_checker_.CalledOnValidThread()); | 451 DCHECK(thread_checker_.CalledOnValidThread()); |
446 DCHECK(volume >= 0.0f && volume <= 1.0f); | 452 DCHECK(volume >= 0.0f && volume <= 1.0f); |
447 | 453 |
448 playing_state_.set_volume(volume); | 454 playing_state_.set_volume(volume); |
449 OnPlayStateChanged(media_stream_, &playing_state_); | 455 OnPlayStateChanged(media_stream_, &playing_state_); |
450 } | 456 } |
451 | 457 |
452 base::TimeDelta WebRtcAudioRenderer::GetCurrentRenderTime() const { | 458 base::TimeDelta WebRtcAudioRenderer::GetCurrentRenderTime() const { |
453 return base::TimeDelta(); | 459 DCHECK(thread_checker_.CalledOnValidThread()); |
460 return current_time_; | |
454 } | 461 } |
455 | 462 |
456 bool WebRtcAudioRenderer::IsLocalRenderer() const { | 463 bool WebRtcAudioRenderer::IsLocalRenderer() const { |
457 return false; | 464 return false; |
458 } | 465 } |
459 | 466 |
460 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, | 467 int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus, |
461 int audio_delay_milliseconds) { | 468 int audio_delay_milliseconds) { |
462 base::AutoLock auto_lock(lock_); | 469 base::AutoLock auto_lock(lock_); |
463 if (!source_) | 470 if (!source_) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 if (RemovePlayingState(source, state)) | 588 if (RemovePlayingState(source, state)) |
582 EnterPauseState(); | 589 EnterPauseState(); |
583 } else if (AddPlayingState(source, state)) { | 590 } else if (AddPlayingState(source, state)) { |
584 EnterPlayState(); | 591 EnterPlayState(); |
585 } | 592 } |
586 UpdateSourceVolume(source); | 593 UpdateSourceVolume(source); |
587 } | 594 } |
588 } | 595 } |
589 | 596 |
590 } // namespace content | 597 } // namespace content |
OLD | NEW |