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

Unified Diff: media/audio/audio_device_thread.cc

Issue 2437863004: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: fixed excessive logging Created 4 years, 1 month 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_device_thread.h ('k') | media/audio/audio_input_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_device_thread.cc
diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
index edbdbd89cedd42f32d83fed4999114c06b609255..7688c3fd1833041986205197c84b8f0e13063098 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -67,12 +67,14 @@ void AudioDeviceThread::ThreadMain() {
uint32_t buffer_index = 0;
while (true) {
- uint32_t pending_data = 0;
- size_t bytes_read = socket_.Receive(&pending_data, sizeof(pending_data));
- if (bytes_read != sizeof(pending_data))
+ Packet packet = {0, 0};
+ size_t bytes_read = socket_.Receive(&packet, sizeof(packet));
+ if (bytes_read != sizeof(packet)) {
+ LOG(ERROR) << "Failed to receive.";
chcunningham 2016/10/31 20:08:35 I'm surprised this ever happens. What am I missing
miu 2016/10/31 20:59:04 It seems legitimate for Receive() to return zero w
break;
+ }
- // std::numeric_limits<uint32_t>::max() is a special signal which is
+ // std::numeric_limits<int64_t>::max() is a special signal which is
// returned after the browser stops the output device in response to a
// renderer side request.
//
@@ -80,8 +82,11 @@ void AudioDeviceThread::ThreadMain() {
// the buffer index for synchronized buffers though.
//
// See comments in AudioOutputController::DoPause() for details on why.
- if (pending_data != std::numeric_limits<uint32_t>::max())
- callback_->Process(pending_data);
+ if (packet.pending_data != std::numeric_limits<int64_t>::max()) {
+ callback_->Process(packet.pending_data,
+ base::TimeTicks() + base::TimeDelta::FromMicroseconds(
+ packet.data_timestamp_us));
+ }
// The usage of synchronized buffers differs between input and output cases.
//
« no previous file with comments | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698