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

Issue 22886005: Switch audio synchronization from sleep() based to select() based. (Closed)

Created:
7 years, 4 months ago by DaleCurtis
Modified:
7 years, 2 months ago
CC:
chromium-reviews, jam, joi+watch-content_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, erikwright+watch_chromium.org, miu+watch_chromium.org, DaveMoore, scherkus (not reviewing), no longer working on chromium, chihchung, hychao
Visibility:
Public.

Description

Switch audio synchronization from sleep() based to select() based. Uses select() to efficiently wait for data from the renderer with a timeout instead of using sleep() or always assuming the renderer is ready. Fixes glitching and / or CPU hogging when the renderer isn't ready. BUG=179058, 180841, 260772, 269672 , TEST=Swap from 44kHz to 16kHz html5 playback, ensure glitch free. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=230515

Patch Set 1 #

Total comments: 28

Patch Set 2 : Comments. Split out base/ changes. #

Total comments: 13

Patch Set 3 : Rebase. Fix timeout. Comments. #

Total comments: 2

Patch Set 4 : Comments. #

Patch Set 5 : Fix DCHECK. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -370 lines) Patch
M content/browser/renderer_host/media/audio_renderer_host.cc View 1 2 3 chunks +3 lines, -7 lines 0 comments Download
M content/browser/renderer_host/media/audio_sync_reader.h View 1 2 3 chunks +13 lines, -8 lines 0 comments Download
M content/browser/renderer_host/media/audio_sync_reader.cc View 1 2 3 4 6 chunks +82 lines, -97 lines 0 comments Download
M content/renderer/pepper/pepper_audio_input_host.cc View 1 2 chunks +1 line, -8 lines 0 comments Download
M media/audio/audio_device_thread.h View 1 2 chunks +5 lines, -3 lines 0 comments Download
M media/audio/audio_device_thread.cc View 1 2 6 chunks +29 lines, -10 lines 0 comments Download
M media/audio/audio_input_device.cc View 1 1 chunk +4 lines, -4 lines 0 comments Download
M media/audio/audio_output_controller.h View 1 2 1 chunk +4 lines, -5 lines 0 comments Download
M media/audio/audio_output_controller.cc View 1 2 3 chunks +6 lines, -22 lines 0 comments Download
M media/audio/audio_output_controller_unittest.cc View 1 2 3 chunks +5 lines, -6 lines 0 comments Download
M media/audio/audio_output_device.cc View 1 2 5 chunks +14 lines, -37 lines 0 comments Download
M media/audio/audio_output_device_unittest.cc View 1 2 3 chunks +2 lines, -9 lines 0 comments Download
M media/audio/audio_parameters.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M media/audio/audio_parameters.cc View 1 chunk +6 lines, -0 lines 0 comments Download
D media/audio/shared_memory_util.h View 1 1 chunk +0 lines, -39 lines 0 comments Download
D media/audio/shared_memory_util.cc View 1 2 1 chunk +0 lines, -72 lines 0 comments Download
M media/shared_memory_support.gypi View 1 1 chunk +0 lines, -2 lines 0 comments Download
M ppapi/proxy/audio_input_resource.cc View 1 2 3 2 chunks +2 lines, -9 lines 0 comments Download
M ppapi/proxy/ppb_audio_proxy.cc View 1 3 chunks +2 lines, -16 lines 0 comments Download
M ppapi/shared_impl/ppb_audio_shared.cc View 1 4 chunks +8 lines, -16 lines 0 comments Download

Messages

Total messages: 32 (0 generated)
DaleCurtis
Guys, I'm not sure if we actually want to do this, but I suspect without ...
7 years, 4 months ago (2013-08-16 22:15:55 UTC) #1
DaleCurtis
Plus +dgreid, +davemoore too, since the Yield() / Sleep() approach recently came under fire on ...
7 years, 4 months ago (2013-08-16 22:16:56 UTC) #2
miu
Dale, I like where this is going: This may fix a "static in music" bug ...
7 years, 4 months ago (2013-08-17 02:39:13 UTC) #3
henrika (OOO until Aug 14)
Dale, your patch looks really nice but it is not clear to me how you ...
7 years, 4 months ago (2013-08-19 07:18:40 UTC) #4
DaleCurtis
Henrik, the most noticeable playback improvement is on OSX since we have no blocking solution ...
7 years, 4 months ago (2013-08-19 16:22:03 UTC) #5
DaleCurtis
To be clearer: I've only tested this on OSX and Linux so far, I haven't ...
7 years, 4 months ago (2013-08-19 16:23:27 UTC) #6
DaveMoore
https://codereview.chromium.org/22886005/diff/1/content/browser/renderer_host/media/audio_sync_reader.cc File content/browser/renderer_host/media/audio_sync_reader.cc (right): https://codereview.chromium.org/22886005/diff/1/content/browser/renderer_host/media/audio_sync_reader.cc#newcode189 content/browser/renderer_host/media/audio_sync_reader.cc:189: maximum_wait_time_); Does it mean anything (skipping) if something other ...
7 years, 4 months ago (2013-08-19 22:49:43 UTC) #7
DaleCurtis
https://codereview.chromium.org/22886005/diff/1/content/browser/renderer_host/media/audio_sync_reader.cc File content/browser/renderer_host/media/audio_sync_reader.cc (right): https://codereview.chromium.org/22886005/diff/1/content/browser/renderer_host/media/audio_sync_reader.cc#newcode189 content/browser/renderer_host/media/audio_sync_reader.cc:189: maximum_wait_time_); On 2013/08/19 22:49:43, DaveMoore wrote: > Does it ...
7 years, 4 months ago (2013-08-19 23:08:22 UTC) #8
henrika (OOO until Aug 14)
https://codereview.chromium.org/22886005/diff/1/base/sync_socket.h File base/sync_socket.h (right): https://codereview.chromium.org/22886005/diff/1/base/sync_socket.h#newcode60 base/sync_socket.h:60: virtual size_t Receive(void* buffer, size_t length, base::TimeDelta timeout); Extend ...
7 years, 4 months ago (2013-08-20 07:50:30 UTC) #9
tommi (sloooow) - chröme
Great that you're tackling this. I did some work a while back in this direction ...
7 years, 4 months ago (2013-08-20 10:55:56 UTC) #10
DaleCurtis
https://codereview.chromium.org/22886005/diff/1/base/sync_socket_posix.cc File base/sync_socket_posix.cc (right): https://codereview.chromium.org/22886005/diff/1/base/sync_socket_posix.cc#newcode128 base/sync_socket_posix.cc:128: if (file_util::ReadFromFD(handle_, charbuffer, length)) On 2013/08/20 10:55:57, tommi wrote: ...
7 years, 4 months ago (2013-08-20 18:27:50 UTC) #11
tommi (sloooow) - chröme
Is there another patchset on the way? https://codereview.chromium.org/22886005/diff/1/base/sync_socket_posix.cc File base/sync_socket_posix.cc (right): https://codereview.chromium.org/22886005/diff/1/base/sync_socket_posix.cc#newcode128 base/sync_socket_posix.cc:128: if (file_util::ReadFromFD(handle_, ...
7 years, 4 months ago (2013-08-21 12:33:25 UTC) #12
DaleCurtis
I was using the current patch set as a vehicle for discussion, so I haven't ...
7 years, 4 months ago (2013-08-21 17:36:09 UTC) #13
tommi (sloooow) - chröme
On 2013/08/21 17:36:09, DaleCurtis wrote: > I was using the current patch set as a ...
7 years, 4 months ago (2013-08-21 17:59:30 UTC) #14
henrika (OOO until Aug 14)
Go for it.
7 years, 4 months ago (2013-08-21 20:17:45 UTC) #15
miu
On 2013/08/21 20:17:45, henrika wrote: > Go for it. +1
7 years, 4 months ago (2013-08-22 01:30:47 UTC) #16
scherkus (not reviewing)
On 2013/08/22 01:30:47, Yuri wrote: > On 2013/08/21 20:17:45, henrika wrote: > > Go for ...
7 years, 4 months ago (2013-08-23 19:27:46 UTC) #17
DaleCurtis
In the event of failure, I suspect this will be sufficiently catastrophic to roll back ...
7 years, 3 months ago (2013-08-26 21:14:10 UTC) #18
kaustubh.j
Have you verified this patch with multi-tab scenario ?; also could you please share performance ...
7 years, 3 months ago (2013-08-30 07:34:54 UTC) #19
DaleCurtis
xians, davemoore, scherkus to cc -- the rest, please review. I've split out the base/ ...
7 years, 3 months ago (2013-09-11 01:16:03 UTC) #20
henrika (OOO until Aug 14)
Thanks for improving and cleaning up in this rather complex area of the code Dale. ...
7 years, 3 months ago (2013-09-13 10:25:44 UTC) #21
henrika (OOO until Aug 14)
I have tried this patch on Android and it does reduce the miss rate for ...
7 years, 2 months ago (2013-09-30 08:52:06 UTC) #22
tommi (sloooow) - chröme
Lgtm. Sorry for the delay :-(
7 years, 2 months ago (2013-10-12 09:14:09 UTC) #23
DaleCurtis
+bbudge for ppapi/ changes. Okay guys, this is all ready for review. The base/ changes ...
7 years, 2 months ago (2013-10-22 23:13:48 UTC) #24
miu
lgtm
7 years, 2 months ago (2013-10-23 00:03:39 UTC) #25
bbudge
ppapi LGTM. Did you verify that NaCl audio works? I'm not sure how good our ...
7 years, 2 months ago (2013-10-23 00:31:07 UTC) #26
DaleCurtis
Yes, I verified using NaClBox (Duke Nukem II!) which required me to fix this bug: ...
7 years, 2 months ago (2013-10-23 00:36:05 UTC) #27
dgreid
code lgtm, haven't tested it and I'm away at a conference for the week. +chihchung,hychao ...
7 years, 2 months ago (2013-10-23 10:41:10 UTC) #28
dgreid
hychao was nice enough to test successfuly on link and spring.
7 years, 2 months ago (2013-10-23 13:00:50 UTC) #29
DaleCurtis
Thanks everyone!
7 years, 2 months ago (2013-10-23 17:23:27 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/22886005/353001
7 years, 2 months ago (2013-10-23 17:25:29 UTC) #31
commit-bot: I haz the power
7 years, 2 months ago (2013-10-23 21:33:48 UTC) #32
Message was sent while issue was closed.
Change committed as 230515

Powered by Google App Engine
This is Rietveld 408576698