From f387b35af395c0a636a721b5cef33a46444a0b27 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Tue, 16 Jun 2009 21:30:38 +0000 Subject: Since the introduction of PushSource, there are two buffering layers in the browser process, the hardware buffer used in AudioOutputStream and transportation buffer in PushSource. Together with the latency in the IPC audio layer we have a serious AV sync problem. To compensate the delay and latency introduced by these three factors two parameters are added in RequestAudioPacket message that include the buffer fill level and timestamp of the request. These two parameters are used to determine the playback delay to be used by the audio renderer to update the pipeline with the time delta. So we have three parameters we need to care about: 1. Hardware buffer in AudioOutputStream 2. Buffered data in PushSource 3. IPC latency We have accurate values for 2 and 3 but not 1. We currently don't have the API in AudioOutputStream to query the remaining buffer in the hardware buffer. But usually there is a large amount of data in it, e.g. on Windows 400ms worth of data. Since we now detached the hardware buffer request of OnMoreData() from the actual packet request of IPC (by the introduction of PushSource), it is really critical to know the buffer level in the hardware. I made a guess of this buffer level by using the amount of last buffer copy. Review URL: http://codereview.chromium.org/122020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18536 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/render_messages_internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'chrome/common/render_messages_internal.h') diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index f7ba56c..7de2db7 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -508,8 +508,10 @@ IPC_BEGIN_MESSAGES(View) bool /* Whether it is visible */) // Sent by AudioRendererHost to renderer to request an audio packet. - IPC_MESSAGE_ROUTED1(ViewMsg_RequestAudioPacket, - int /* stream id */) + IPC_MESSAGE_ROUTED3(ViewMsg_RequestAudioPacket, + int /* stream id */, + size_t /* bytes in buffer */, + int64 /* message timestamp */) // Tell the renderer process that the audio stream has been created, renderer // process would be given a ShareMemoryHandle that it should write to from -- cgit v1.1