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

Unified Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added implementation for ALSA. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_sync_reader.cc
diff --git a/content/browser/renderer_host/media/audio_sync_reader.cc b/content/browser/renderer_host/media/audio_sync_reader.cc
index 943cedb4d0b6a839e1e1f82a95c77a3f9cce4e58..f909a58b7b6803540fdb5b6d1f9431ab642fd900 100644
--- a/content/browser/renderer_host/media/audio_sync_reader.cc
+++ b/content/browser/renderer_host/media/audio_sync_reader.cc
@@ -13,10 +13,12 @@
#include "build/build_config.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/public/common/content_switches.h"
+#include "media/audio/audio_device_thread.h"
#include "media/base/audio_parameters.h"
using media::AudioBus;
using media::AudioOutputBuffer;
+using Packet = media::AudioDeviceThread::Packet;
namespace {
@@ -106,8 +108,10 @@ AudioSyncReader::~AudioSyncReader() {
}
// media::AudioOutputController::SyncReader implementations.
-void AudioSyncReader::UpdatePendingBytes(uint32_t bytes,
- uint32_t frames_skipped) {
+void AudioSyncReader::UpdatePendingBytes(
+ uint32_t bytes,
+ uint32_t frames_skipped,
+ const media::AudioTimestamp& output_timestamp) {
// Increase the number of skipped frames stored in shared memory. We don't
// send it over the socket since sending more than 4 bytes might lead to being
// descheduled. The reading side will zero it when consumed.
@@ -119,7 +123,8 @@ void AudioSyncReader::UpdatePendingBytes(uint32_t bytes,
// in the anomalous case if the renderer is unable to keep up with real-time.
output_bus_->Zero();
- socket_->Send(&bytes, sizeof(bytes));
+ Packet packet = {bytes, output_timestamp};
+ socket_->Send(&packet, sizeof(packet));
++buffer_index_;
}

Powered by Google App Engine
This is Rietveld 408576698