Bug 215255 - [GStreamer] Multi-channel (>2) support for the AudioFileReader
Summary: [GStreamer] Multi-channel (>2) support for the AudioFileReader
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-06 22:23 PDT by Lauro Moura
Modified: 2020-10-28 08:29 PDT (History)
12 users (show)

See Also:


Attachments
Patch (905.00 KB, patch)
2020-10-26 02:23 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (904.96 KB, patch)
2020-10-27 02:44 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (905.72 KB, patch)
2020-10-28 07:44 PDT, Philippe Normand
calvaris: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2020-08-06 22:23:40 PDT
web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels.html

Diff:

--- /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-expected.txt
+++ /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-multi-channels-actual.txt
@@ -1,19 +1,40 @@
+CONSOLE MESSAGE: Unhandled Promise Rejection: IndexSizeError: Index must be less than number of channels.
+
+Harness Error (FAIL), message = Unhandled rejection: Index must be less than number of channels.
 
 PASS # AUDIT TASK RUNNER STARTED. 
 PASS Executing "initialize" 
-PASS Executing "test" 
-PASS Audit report 
+TIMEOUT Executing "test" Test timed out
+NOTRUN Audit report 
 PASS > [initialize]  
 PASS   Creating context for testing did not throw an exception. 
 PASS   Fetching expected audio resolved correctly. 
 PASS < [initialize] All assertions passed. (total 2 assertions) 
 PASS > [test] AudioBufferSource with 5.1 buffer 
-PASS   Rendered audio for channel 0 equals [0,0.0626220703125,0.125030517578125,0.18695068359375,0.24810791015625,0.308319091796875,0.3673095703125,0.42486572265625,0.480743408203125,0.53472900390625,0.58660888671875,0.636199951171875,0.68328857421875,0.727691650390625,0.76922607421875,0.8077392578125...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS   Rendered audio for channel 1 equals [0,0.125030517578125,0.24810791015625,0.3673095703125,0.480743408203125,0.58660888671875,0.68328857421875,0.76922607421875,0.84307861328125,0.903717041015625,0.950164794921875,0.981689453125,0.997802734375,0.99822998046875,0.983001708984375,0.952362060546875...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS   Rendered audio for channel 2 equals [0,0.18695068359375,0.3673095703125,0.53472900390625,0.68328857421875,0.8077392578125,0.903717041015625,0.96783447265625,0.997802734375,0.992584228515625,0.952362060546875,0.8785400390625,0.77374267578125,0.641693115234375,0.486968994140625,0.315093994140625...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS   Rendered audio for channel 3 equals [0,0.24810791015625,0.480743408203125,0.68328857421875,0.84307861328125,0.950164794921875,0.997802734375,0.983001708984375,0.90673828125,0.77374267578125,0.592376708984375,0.373931884765625,0.132110595703125,-0.11798095703125,-0.3607177734375,-0.58087158203125...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS   Rendered audio for channel 4 equals [0,0.308319091796875,0.58660888671875,0.8077392578125,0.950164794921875,0.999969482421875,0.952362060546875,0.811920166015625,0.592376708984375,0.315093994140625,0.007110595703125,-0.30157470703125,-0.58087158203125,-0.803558349609375,-0.94793701171875,-0.999969482421875...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS   Rendered audio for channel 5 equals [0,0.3673095703125,0.68328857421875,0.903717041015625,0.997802734375,0.952362060546875,0.77374267578125,0.486968994140625,0.132110595703125,-0.241241455078125,-0.58087158203125,-0.839263916015625,-0.980316162109375,-0.98431396484375,-0.8507080078125,-0.598114013671875...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-PASS < [test] All assertions passed. (total 6 assertions) 
-PASS # AUDIT TASK RUNNER FINISHED: 2 tasks ran successfully. 
+FAIL X Rendered audio for channel 0 does not equal [0,0.1861751526594162,0.3613242506980896,0.515174388885498,0.6390267014503479,0.7263950705528259,0.7733817100524902,0.7789543271064758,0.7449777126312256,0.6759617924690247,0.5787030458450317,0.46165162324905396,0.3342832326889038,0.20631587505340576,0.08695652335882187,-0.015687650069594383...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}.
+	Index	Actual			Expected		AbsError		RelError		Test threshold
+	[1]	6.2648326158523560e-2	1.8617515265941620e-1	1.2352682650089264e-1	6.6349791976198502e-1	3.0517578125000000e-5
+	[2]	1.2505052983760834e-1	3.6132425069808960e-1	2.3627372086048126e-1	6.5391049840688287e-1	3.0517578125000000e-5
+	[3]	1.8696144223213196e-1	5.1517438888549805e-1	3.2821294665336609e-1	6.3709096130225962e-1	3.0517578125000000e-5
+	[4]	2.4813784658908844e-1	6.3902670145034790e-1	3.9088885486125946e-1	6.1169408723311591e-1	3.0517578125000000e-5
+	[5]	3.0833941698074341e-1	7.2639507055282593e-1	4.1805565357208252e-1	5.7552104979721241e-1	3.0517578125000000e-5
+	...and 44075 more errors.
+	Max AbsError of 1.0931923985481262e+0 at index of 420.
+	[420]	9.3087375164031982e-1	-1.6231864690780640e-1	1.0931923985481262e+0	6.7348540625097542e+0	3.0517578125000000e-5
+	Max RelError of 6.5675502002900328e+2 at index of 423.
+	[423]	9.8276454210281372e-1	1.4941194094717503e-3	9.8127042269334197e-1	6.5675502002900328e+2	3.0517578125000000e-5
+ assert_true: expected true got false
+FAIL X Rendered audio for channel 1 does not equal [0,0.2148314118385315,0.41477343440055847,0.5863749980926514,0.7189911603927612,0.8057457208633423,0.8440589308738708,0.8356673717498779,0.7861993312835693,0.7042802572250366,0.6003938913345337,0.48555007576942444,0.3700762093067169,0.26249128580093384,0.16877174377441406,0.09205760061740875...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}.
+	Index	Actual			Expected		AbsError		RelError		Test threshold
+	[1]	1.2505052983760834e-1	2.1483141183853149e-1	8.9780882000923157e-2	4.1791319636442631e-1	3.0517578125000000e-5
+	[2]	2.4813784658908844e-1	4.1477343440055847e-1	1.6663558781147003e-1	4.0175086924816239e-1	3.0517578125000000e-5
+	[3]	3.6732959747314453e-1	5.8637499809265137e-1	2.1904540061950684e-1	3.7355856121426262e-1	3.0517578125000000e-5
+	[4]	4.8075455427169800e-1	7.1899116039276123e-1	2.3823660612106323e-1	3.3134844938972879e-1	3.0517578125000000e-5
+	[5]	5.8663201332092285e-1	8.0574572086334229e-1	2.1911370754241943e-1	2.7193902724999020e-1	3.0517578125000000e-5
+	...and 44075 more errors.
+	Max AbsError of 1.0302199386060238e+0 at index of 565.
+	[565]	9.8829370737075806e-1	-4.1926231235265732e-2	1.0302199386060238e+0	2.4572204757089327e+1	3.0517578125000000e-5
+	Max RelError of 4.1236439891757756e+4 at index of 1470.
+	[1470]	8.6602538824081421e-1	-2.1001967979827896e-5	8.6604639020879404e-1	4.1236439891757756e+4	3.0517578125000000e-5
+ assert_true: expected true got false
Comment 1 Philippe Normand 2020-10-26 02:23:12 PDT
Created attachment 412296 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2020-10-26 09:47:59 PDT
Comment on attachment 412296 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412296&action=review

> Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:210
> +    auto result = m_buffers.ensure(channelId, [&] {
> +        return gst_buffer_list_new();
> +    });

The way you use it, how is it bumping the reference if you switch it to a smart ptr?
Comment 3 Philippe Normand 2020-10-26 09:56:33 PDT
Comment on attachment 412296 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412296&action=review

>> Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:210
>> +    });
> 
> The way you use it, how is it bumping the reference if you switch it to a smart ptr?

I tried already storing GRefPtrs in the hashtable. They endup with a refcount of 2, I think one from the hashtable storage and an extra one when getting existing elements from it.
Comment 4 Peng Liu 2020-10-26 13:07:18 PDT
Comment on attachment 412296 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412296&action=review

> Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:204
> +        int frames = gst_buffer_get_size(buffer) / info.bpf;

Nit. Looks like the local variable "frames" is not needed.
Comment 5 Philippe Normand 2020-10-27 02:00:51 PDT
Comment on attachment 412296 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412296&action=review

>> Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:204
>> +        int frames = gst_buffer_get_size(buffer) / info.bpf;
> 
> Nit. Looks like the local variable "frames" is not needed.

👍
Comment 6 Philippe Normand 2020-10-27 02:44:41 PDT
Created attachment 412404 [details]
Patch
Comment 7 Philippe Normand 2020-10-28 07:44:12 PDT
Created attachment 412528 [details]
Patch
Comment 8 Xabier Rodríguez Calvar 2020-10-28 08:14:44 PDT
Comment on attachment 412528 [details]
Patch

Good to go!
Comment 9 Philippe Normand 2020-10-28 08:28:35 PDT
Committed r269104: <https://trac.webkit.org/changeset/269104>
Comment 10 Radar WebKit Bug Importer 2020-10-28 08:29:22 PDT
<rdar://problem/70764971>