New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 765367 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug-Regression



Sign in to add a comment

WebAudio - baseLatency is unaffected by numeric latencyHint values on Windows

Reported by to...@helloeko.com, Sep 14 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36

Example URL:
https://s3.amazonaws.com/storage2.interlude.fm/dev_temp/tomer/baselatency.html

Steps to reproduce the problem:
1. on windows, navigate to https://s3.amazonaws.com/storage2.interlude.fm/dev_temp/tomer/baselatency.html
2. For all the numeric latencyHint values, audio context has the same baseLatency value (0.01).

What is the expected behavior?
base latency should vary according to requested latenctyHint value (as it does on macOS and on Android).

What went wrong?
Base latency is not affected by numeric latencyHint values on Windows.
This creates actual WebAudio playback issues - on some weaker computers, the low latency (0.01) causes distorted playback (with many hiccups).

Did this work before? Yes 60

Is it a problem with Flash or HTML5? HTML5

Does this work in other browsers? N/A

Chrome version: 61.0.3163.91  Channel: stable
OS Version: 10.0
Flash Version: 

Contents of chrome://gpu: 
Note: To properly save this page, select the "Webpage, Complete" option in the Save File dialog.
Graphics Feature Status
Canvas: Hardware accelerated
CheckerImaging: Disabled
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Native GpuMemoryBuffers: Software only. Hardware acceleration disabled
Rasterization: Hardware accelerated
Video Decode: Hardware accelerated
Video Encode: Hardware accelerated
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
Driver Bug Workarounds
clear_uniforms_before_first_program_use
decode_encode_srgb_for_generatemipmap
disable_delayed_copy_nv12
disable_discard_framebuffer
disable_dxgi_zero_copy_video
disable_framebuffer_cmaa
exit_on_context_lost
force_cube_complete
scalarize_vec_and_mat_constructor_args
texsubimage_faster_than_teximage
Problems Detected
Some drivers are unable to reset the D3D device in the GPU process sandbox
Applied Workarounds: exit_on_context_lost
TexSubImage is faster for full uploads on ANGLE
Applied Workarounds: texsubimage_faster_than_teximage
Clear uniforms before first program use on all platforms: 124764, 349137
Applied Workarounds: clear_uniforms_before_first_program_use
Always rewrite vec/mat constructors to be consistent: 398694
Applied Workarounds: scalarize_vec_and_mat_constructor_args
ANGLE crash on glReadPixels from incomplete cube map texture: 518889
Applied Workarounds: force_cube_complete
Framebuffer discarding can hurt performance on non-tilers: 570897
Applied Workarounds: disable_discard_framebuffer
Limited enabling of Chromium GL_INTEL_framebuffer_CMAA: 535198
Applied Workarounds: disable_framebuffer_cmaa
Zero-copy NV12 video displays incorrect colors on NVIDIA drivers.: 635319
Applied Workarounds: disable_dxgi_zero_copy_video
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Decode and Encode before generateMipmap for srgb format textures on Windows: 634519
Applied Workarounds: decode_encode_srgb_for_generatemipmap
Delayed copy NV12 displays incorrect colors on NVIDIA drivers.: 728670
Applied Workarounds: disable_delayed_copy_nv12
Native GpuMemoryBuffers have been disabled, either via about:flags or command line.
Disabled Features: native_gpu_memory_buffers
Checker-imaging has been disabled via finch trial or the command line.
Disabled Features: checker_imaging
Version Information
Data exported	9/14/2017, 3:48:50 PM
Chrome version	Chrome/61.0.3163.91
Operating system	Windows NT 10.0.15063
Software rendering list version	13.10
Driver bug list version	10.28
ANGLE commit id	0d2ecb4ea992
2D graphics backend	Skia/61 0eefc0552cfb5ac077560b7c2630c5bd475ea585-
Command Line	"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --flag-switches-begin --allow-insecure-localhost --enable-tab-audio-muting --flag-switches-end
Driver Information
Initialization time	94
In-process GPU	false
Passthrough Command Decoder	false
Supports overlays	false
Sandboxed	false
GPU0	VENDOR = 0x10de, DEVICE= 0x1382
Optimus	false
Optimus	false
AMD switchable	false
Desktop compositing	Aero Glass
Diagonal Monitor Size of \\.\DISPLAY2	23.7"
Diagonal Monitor Size of \\.\DISPLAY1	23.7"
Driver vendor	NVIDIA
Driver version	22.21.13.8233
Driver date	5-17-2017
Pixel shader version	5.0
Vertex shader version	5.0
Max. MSAA samples	8
Machine model name	
Machine model version	
GL_VENDOR	Google Inc.
GL_RENDERER	ANGLE (NVIDIA GeForce GTX 745 Direct3D11 vs_5_0 ps_5_0)
GL_VERSION	OpenGL ES 3.0 (ANGLE 2.1.0.0d2ecb4ea992)
GL_EXTENSIONS	GL_ANGLE_client_arrays GL_ANGLE_depth_texture GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_instanced_arrays GL_ANGLE_lossy_etc_decode GL_ANGLE_pack_reverse_row_order GL_ANGLE_program_cache_control GL_ANGLE_request_extension GL_ANGLE_robust_client_memory GL_ANGLE_robust_resource_initialization GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_texture_usage GL_ANGLE_translated_shader_source GL_CHROMIUM_bind_generates_resource GL_CHROMIUM_bind_uniform_location GL_CHROMIUM_color_buffer_float_rgb GL_CHROMIUM_color_buffer_float_rgba GL_CHROMIUM_copy_compressed_texture GL_CHROMIUM_copy_texture GL_CHROMIUM_sync_query GL_EXT_blend_minmax GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_frag_depth GL_EXT_map_buffer_range GL_EXT_occlusion_query_boolean GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_sRGB GL_EXT_shader_texture_lod GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc_srgb GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_norm16 GL_EXT_texture_rg GL_EXT_texture_storage GL_EXT_unpack_subimage GL_KHR_debug GL_NV_EGL_stream_consumer_external GL_NV_fence GL_NV_pack_subimage GL_NV_pixel_buffer_object GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth32 GL_OES_element_index_uint GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object
Disabled Extensions	GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent
Window system binding vendor	Google Inc. (adapter LUID: 000000000000918f)
Window system binding version	1.4 (ANGLE 2.1.0.0d2ecb4ea992)
Window system binding extensions	EGL_EXT_create_context_robustness EGL_ANGLE_d3d_share_handle_client_buffer EGL_ANGLE_d3d_texture_client_buffer EGL_ANGLE_surface_d3d_texture_2d_share_handle EGL_ANGLE_query_surface_pointer EGL_ANGLE_window_fixed_size EGL_ANGLE_keyed_mutex EGL_ANGLE_surface_orientation EGL_ANGLE_direct_composition EGL_NV_post_sub_buffer EGL_KHR_create_context EGL_EXT_device_query EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_get_all_proc_addresses EGL_KHR_stream EGL_KHR_stream_consumer_gltexture EGL_NV_stream_consumer_gltexture_yuv EGL_ANGLE_flexible_surface_compatibility EGL_ANGLE_stream_producer_d3d_texture_nv12 EGL_ANGLE_create_context_webgl_compatibility EGL_CHROMIUM_create_context_bind_generates_resource EGL_CHROMIUM_sync_control EGL_EXT_pixel_format_float EGL_KHR_surfaceless_context EGL_ANGLE_display_texture_share_group EGL_ANGLE_create_context_client_arrays EGL_ANGLE_program_cache_control
Direct rendering	Yes
Reset notification strategy	0x8252
GPU process crash count	0
Compositor Information
Tile Update Mode	One-copy
Partial Raster	Enabled
GpuMemoryBuffers Status
ATC	Software only
ATCIA	Software only
DXT1	Software only
DXT5	Software only
ETC1	Software only
R_8	Software only
R_16	Software only
RG_88	Software only
BGR_565	Software only
RGBA_4444	Software only
RGBX_8888	Software only
RGBA_8888	Software only
BGRX_8888	Software only
BGRA_8888	Software only
RGBA_F16	Software only
YVU_420	Software only
YUV_420_BIPLANAR	Software only
UYVY_422	Software only
Diagnostics
... loading ...
Log Messages
[12124:15992:0914/151438.558:ERROR:mf_helpers.cc(14)] : Error in dxva_video_decode_accelerator_win.cc on line 1551
[12124:15992:0914/151438.558:ERROR:mf_helpers.cc(14)] : Error in dxva_video_decode_accelerator_win.cc on line 632
[12124:15992:0914/151438.570:ERROR:gpu_video_decode_accelerator.cc(381)] : HW video decode not available for profile vp9 profile0
[12124:8728:0914/151444.847:WARNING:angle_platform_impl.cc(41)] : rx::HLSLCompiler::compileToBinary(224): C:\fakepath(69,11-35): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them C:\fakepath(91,11-35): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
[12124:15992:0914/152021.500:ERROR:mf_helpers.cc(14)] : Error in dxva_video_decode_accelerator_win.cc on line 1551
[12124:15992:0914/152021.500:ERROR:mf_helpers.cc(14)] : Error in dxva_video_decode_accelerator_win.cc on line 632
[12124:15992:0914/152021.505:ERROR:gpu_video_decode_accelerator.cc(381)] : HW video decode not available for profile vp9 profile0
GpuProcessHostUIShim: The GPU process exited normally. Everything is okay.
 
Components: -Internals>Media Blink>WebAudio
Labels: Needs-Bisect Needs-Triage-M61

Comment 3 by gov...@chromium.org, Sep 14 2017

Cc: pbomm...@chromium.org ranjitkan@chromium.org
Labels: M-61
Cc: andrew.macpherson@soundtrap.com gov...@chromium.org abdulsyed@chromium.org hongchan@chromium.org dalecur...@chromium.org olka@chromium.org
Labels: -Pri-2 -Needs-Bisect hasbisect-per-revision ReleaseBlock-Stable Pri-1
Owner: mkwst@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on stable 61.0.3163.91 and is regression broken in M61 builds. Issue is windows specific and not observed on Mac and Linux OS. Below are the bisect details for the same:

Bisect Info:
============
61.0.3149.0 - G
61.0.3150.0 - B

Change Log: https://chromium.googlesource.com/chromium/src/+log/2733ee3f00fbb5201eb94c294bfc913c998401f0..3fe2409358437193a07496c2d0a0b559ef399760

Suspecting below change could be a possible culprit:

https://chromium.googlesource.com/chromium/src/+/3fe2409358437193a07496c2d0a0b559ef399760

andrew.macpherson@: Request you to please take a look into it. Looping the reviewers of the CL as cannot assign the issue directly to the cl committer.

Tagging the issue with stable blocker as regressed in M61, please undo if not the case.

Thanks.!

Hello! The change to ignore the latencyHint exact value on Windows was intentional as I believe that Windows doesn't respect user-specified buffer sizes anyway and just uses the result from CoreAudioUtil::GetPreferredAudioParameters(). In previous versions it was reporting changed values but this wasn't true, so Web Audio would adjust its callback size to the one reported in baseLatency but the underlying audio hardware would still be running at the same (unchanged) buffer size. Looking at the linked example in fact it may be a bug that 'playback' is reporting a different buffer size, as I believe there is only one fixed size ever used by each audio device, though maybe someone else can confirm this.

Something that is a concern though is if there is more glitching in the latest version, nothing in the above CL should have changed the default Windows buffer sizes and ~10ms should have been the only latency available on Windows with Web Audio before the latencyHint work began so I may have misunderstood something. Do you have an example where we can see the distorted playback issue? Thanks!

Comment 6 by to...@helloeko.com, Sep 15 2017

Thanks for looking into this, really appreciate it!

This video uses WebAudio for audio playback:
https://video.helloeko.com/v/MdDQnM?debug=true

The person who made the video complained about audio glitching on his older/weaker laptop.
We added a latenyHint value which supposedly fixed the problem for him.
He then complained that the glitching has resurfaced on Chrome 61.

I don't get glitching on my Windows machine, but I've heard it on his computer and the audio sounds terrible - super glitchy.
Cc: rtoy@chromium.org

Comment 8 by rtoy@chromium.org, Sep 15 2017

Note also that in 60 and 61, we added a new threading system (to support the upcoming AudioWorklet).  An unfortunate side-effect was to introduce glitching, especially on slower, less powerful machines, that no one noticed until just recently.

So, it would be really great if you can try this with 62 (beta, I think). We know 62 fixed the glitching issue for other users.

Comment 9 by to...@helloeko.com, Sep 15 2017

Ok, thanks, I'll tell the owner of that laptop to try it out and report back.
Will keep you posted.
Does Chrome Canary (63) also include the fix ?

Comment 10 by rtoy@chromium.org, Sep 15 2017

Fantastic!  Yes, 63 has the fix too.
The version 62.0.3198.0 and above have the fix for the alternative rendering thread issue. If you hear no or less glitch by using the version 62<, we can confirm that it's the same issue.

Comment 12 by rtoy@chromium.org, Sep 15 2017

Labels: -ReleaseBlock-Stable -M-61 M-62
Removing ReleaseBlock-Stable and moving milestone to 62.

Comment 13 by to...@helloeko.com, Sep 16 2017

Ok, he tested and audio plays smoothly on Canary...

Comment 14 by rtoy@chromium.org, Sep 18 2017

Thanks for testing!  Sounds like it's the same underlying problem with the separate thread (since removed for 62).

Comment 15 by to...@helloeko.com, Sep 26 2017

Just stumbled upon an issue which is kinda related to the original bug description.
On the Pixel, looks like the base latency is out of whack.
Navigate to the test page on a Pixel:
https://s3.amazonaws.com/storage2.interlude.fm/dev_temp/tomer/baselatency.html

Looks like giving a numeric latencyHint value will cause the baseLatency to be very low (4 ms), which does cause playback issues.

Also weird is that "playback" gives a lower base latency value than "interactive".

Tested on Android Chrome 61 and 63, running Android 8.

Comment 16 by rtoy@chromium.org, Sep 26 2017

tomer@  You mean a Pixel phone and not Pixel chromebook?  Could you paste the results that you get here, for the record?

It's known that on Android devices "interactive" gives a really funny latency value that is larger than "balanced", possibly also "playback".  We don't do a great job of selecting the latency for "interactive".  We need to revisit that.

Comment 17 by to...@helloeko.com, Sep 26 2017

Yes, I meant a Pixel phone, sorry for not being clear.
Attached a screenshot with the values I'm getting on the Pixel phone.
crbug_765367_pixel_phone.png
104 KB View Download
BTW - the issue mentioned in #15 and #17 also occurs on a Nexus 6P with Android 8.0.0.
Those are the only 2 devices running Android 8 that I have access to - so it might happen on all phones running Android 8.

Comment 19 by rtoy@chromium.org, Nov 28 2017

tomer@  Could you file another issue about the baseLatency on Android being weird with interactive being larger than playback.  That's really a different issue from this one.

And from c#13, I think the glitching problem is fixed in M63 (and 62).

So the only issue remaining is that baseLatency doesn't change anything on Windows.

andrew.macpherson@  I think this is basically WAI, although I would think baseLatency can specify something larger than 10 ms, but not lower, since that is the lowest possible value (I think) on Windows.  WDYT?

Comment 20 by to...@helloeko.com, Nov 28 2017

Opened another issue for the Android 8 latency weirdness:
 https://crbug.com/789301 

rtoy@: Yes that makes sense! The latency could be increased in the Web Audio side regardless of whether it's possible to change the hardware latency.
Project Member

Comment 22 by bugdroid1@chromium.org, Dec 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a2bad0fd17c1f4977a76f6582882e22e2865020a

commit a2bad0fd17c1f4977a76f6582882e22e2865020a
Author: Andrew MacPherson <andrew.macpherson@soundtrap.com>
Date: Thu Dec 21 09:30:45 2017

Use hardware buffer size on Android and honor latencyHint everywhere

For Android devices, set the interactive latency to the hardware
buffer size instead of clamping it to some random value.  This makes
(in many cases) the interactive latency less than balanced and
playback as expected.

UMA stats for Android show that hardware buffer sizes range from a low
of 96 up to 87,360(!). Set a max web audio buffer size of 8192. (The
stats say 8192 includes 99.1% of all devices, as of 2017/11/29.)

Also honor the numeric latencyHint so that the actual buffer size does
change as requested, within limits.

The FIFO size for the AudioDestination also needs to be increased because
the max buffer size is 8192 now for some platforms.

Bug:  765367 ,  789301 
Change-Id: Ia953d7e6a5ca1ea7c4ef449744ff9f1b20b200c4
Reviewed-on: https://chromium-review.googlesource.com/805754
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: Olga Sharonova <olka@chromium.org>
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Commit-Queue: Andrew MacPherson <andrew.macpherson@soundtrap.com>
Cr-Commit-Position: refs/heads/master@{#525654}
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/content/renderer/media/audio_renderer_mixer_manager_unittest.cc
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/content/renderer/media/renderer_webaudiodevice_impl_unittest.cc
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/media/base/audio_latency.cc
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/media/base/audio_latency_unittest.cc
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/media/base/limits.h
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/media/base/mac/audio_latency_mac.cc
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontextoptions.html
[modify] https://crrev.com/a2bad0fd17c1f4977a76f6582882e22e2865020a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp

Comment 23 by rtoy@chromium.org, Jan 8 2018

Cc: -abdulsyed@chromium.org mkwst@chromium.org
Owner: rtoy@chromium.org
Status: Fixed (was: Assigned)
Assigning this to me instead of mkwst. It should really belong to andrew.macpherson@ who did the work, but I can' make him the owner.

I think this is fixed now. I've tested the change on windows, and interactive = balanced = 0.01, playback = 0.02 (sample rate is 48 kHz on my machine).

Setting the numerical latency value works and webaudio returns the same values as requested (because the sample rate is 48 kHz).  A latencyHint of 0.25 returns 0.17 because 8192 is the largest value currently allowed.

Sign in to add a comment