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

Unified Diff: media/audio/audio_output_controller.cc

Issue 2517503003: Reland: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Comments from chcunningham@ and Dale Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller.cc
diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc
index ae879c2fdc106629d4d4b7b004f91fd79373de00..c8a75b6c6d555697c9c8b9b988ff80baf1258277 100644
--- a/media/audio/audio_output_controller.cc
+++ b/media/audio/audio_output_controller.cc
@@ -16,6 +16,7 @@
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
+#include "media/base/audio_timestamp_helper.h"
using base::TimeDelta;
@@ -174,7 +175,7 @@ void AudioOutputController::DoPlay() {
return;
// Ask for first packet.
- sync_reader_->UpdatePendingBytes(0, 0);
+ sync_reader_->RequestMoreData(base::TimeDelta(), base::TimeTicks(), 0);
state_ = kPlaying;
@@ -227,7 +228,7 @@ void AudioOutputController::DoPause() {
// Let the renderer know we've stopped. Necessary to let PPAPI clients know
// audio has been shutdown. TODO(dalecurtis): This stinks. PPAPI should have
// a better way to know when it should exit PPB_Audio_Shared::Run().
- sync_reader_->UpdatePendingBytes(std::numeric_limits<uint32_t>::max(), 0);
+ sync_reader_->RequestMoreData(base::TimeDelta::Max(), base::TimeTicks(), 0);
handler_->OnPaused();
}
@@ -308,12 +309,10 @@ int AudioOutputController::OnMoreData(base::TimeDelta delay,
sync_reader_->Read(dest);
- const int total_bytes_delay =
- delay.InSecondsF() * params_.GetBytesPerSecond();
const int frames = dest->frames();
- sync_reader_->UpdatePendingBytes(
- total_bytes_delay + frames * params_.GetBytesPerFrame(),
- prior_frames_skipped);
+ delay += AudioTimestampHelper::FramesToTime(frames, params_.sample_rate());
+
+ sync_reader_->RequestMoreData(delay, delay_timestamp, prior_frames_skipped);
bool need_to_duplicate = false;
{
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698