audio play at position causes huge jank on first play only
Reported by
just1mor...@gmail.com,
Apr 12 2016
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 Example URL: https://dl.dropboxusercontent.com/u/184657779/chrome%20bugs/audio%20position%20html5/index.html Steps to reproduce the problem: 1. Play the link and observe that the oscillating object's movement freezes when the audio file is commanded to play at the green object's position. What is the expected behavior? The audio file should play at the object position without causing large jank (145 ms) on first play. This works correctly in Edge and IE. What went wrong? Every 3 seconds, an audio file is commanded to play at the green object's position. The first time the audio file plays the browser freezes and no audio is played; each time thereafter the audio file plays correctly without causing jank. This demo was created using Construct 2. A capx file is attached if required to reproduce/edit this. Did this work before? Yes I am not sure of the browser version, but certainly in Chrome 41, when I last used this api. Is it a problem with Flash or HTML5? HTML5 Does this work in other browsers? Yes Chrome version: 49.0.2623.110 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 21.0 r0 Nil.
,
Apr 12 2016
Looks like you're playing the sound w/ WebAudio? I don't see any html5 players being created.
,
Apr 13 2016
Construct 2 is an html5 game engine. I will check about web audio and get back to you. Thanks.
,
Apr 13 2016
Construct 2 plays all sound effects through web audio, but the first time Construct 2 plays a positioned sound, it creates a panner node. It seems in Chrome only, the creation of the first panner node causes audio to cut out momentarily. I assume it's lazy-loading the spatial audio engine?
,
Apr 13 2016
I have not had a chance to try this yet, but Chrome does lazily load the HRTF database when the panner is created. However, this the default panner type is equalpower, not HRTF. Are you using HRTF? That being said, the panner should probably be a pass through if the HRTF database isn't loaded.
,
Apr 19 2016
From the code, I see that the HRTF panner is being created. The HRTF database is loaded when the first panner is created. This does take a little time, but on reasonably fast machines, it's not noticeable. (On slow Android machines it was very noticeable.) The best solution right now is to create the panner node as soon as possible and set the model to HRTF right away. And then to wait a little while before starting.
,
Jul 15 2016
This is caused by a locking issue in the HRTF database loader.
,
Jul 19 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0494c3815a7eebceb73234e8da9e368e97fc1bfb commit 0494c3815a7eebceb73234e8da9e368e97fc1bfb Author: rtoy <rtoy@chromium.org> Date: Tue Jul 19 21:44:22 2016 Simplify locking in HRTFDatabaseLoader The locks in loadTask() and loadAsynchronously() were blocking each other for about 100 msec or more, causing the jank in the bug report. Only the lock is loadTask() is needed because that's what writes the m_hrtfDatabase pointer. loadAsynchronously() doesn't need a lock because it doesn't need to read m_hrtfDatabase. Also simplified isLoaded() and database() which basically do the same thing except for the return type. database() (and, indirectly, isLoaded()) also gets a tryLock because it is called from the audio thread which can't block. BUG= 602668 TEST=No jank in test in 602668 Review-Url: https://codereview.chromium.org/2154473003 Cr-Commit-Position: refs/heads/master@{#406389} [modify] https://crrev.com/0494c3815a7eebceb73234e8da9e368e97fc1bfb/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp [modify] https://crrev.com/0494c3815a7eebceb73234e8da9e368e97fc1bfb/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h
,
Jul 20 2016
Tested the same on win8.1 chrome version 54.0.2802.0 with the URL https://dl.dropboxusercontent.com/u/184657779/chrome%20bugs/audio%20position%20html5/index.html - Observed that sound is paused a short time (<1 second) at the first sound though the text "Playing Sound" is displayed sound is not heard. All the later times it behaves correctly Please find the screencast IE Behavior : Sound is heard for the first sound as well. rtoy@, Could you please confirm on the fix as the issue is still seen
,
Jul 20 2016
I verified with ToT chromium build that the jank is gone. However, there is no sound played for the very first time. I think this is related to the long-standing issue that if the HRTF database is not ready, the panner outputs silence. This should really be changed to make it a pass-through, but that's a different bug. I will test on Win and OSX shortly.
,
Jul 20 2016
Win10, Chrome canary 54.0.2802.0 has a very slight jank still. More investigation needed. OSX Canary is still 54.0.2800.0 which doesn't have this fix.
,
Jul 20 2016
For the record, win10 chrome canary is way better than chrome stable on this test.
,
Jul 20 2016
ToT chromium on OSX has no jank, and, unlike linux, it does play the first sound. However, it seems truncated; it's shorter than the other sounds. I think this is, again, the panner outputting silence until the database is loaded.
,
Jul 20 2016
See issue 629858 for the silence issue on the first sound.
,
Jul 20 2016
tkonchada@ Can you clarify your comment in #c9? Are you saying that you don't see the janky animation anymore but you also no longer hear anything? If this is the case, it is fixed in issue 629858 . While I do possibly see some animation jank it's really hard to know for sure and to know if it's not caused by other things going on on that page.
,
Jul 21 2016
rtoy@, I can confirm that there is no janky animation but the sound is not heard for the first time. Later it is working fine with the sound as well.
,
Jul 21 2016
Thanks for the confirmation. The lack of sound the first time is issue 629858 , where a fix landed yesterday. Closing this (verified), based on my own tests and your tests. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by yini...@chromium.org
, Apr 12 2016