Bug 229325 - Decoding webm file with more than 2 channels will fail
Summary: Decoding webm file with more than 2 channels will fail
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
: 241220 (view as bug list)
Depends on:
Blocks: 227111
  Show dependency treegraph
 
Reported: 2021-08-20 00:58 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-11-25 13:53 PST (History)
10 users (show)

See Also:


Attachments
Patch (24.30 KB, patch)
2021-09-07 19:19 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2021-08-20 00:58:21 PDT
Decoding of webm with more than 2 channels will fail with a decoding error.

STR:
1- Open https://jyavenard.github.io/htmltests/tests/webaudio/decodeAudioData.html
2- Select opus-mapping2.webm in the drop down list
3- press play

Result: will show a decoding error as context.decodeAudioData return an error
Comment 1 Radar WebKit Bug Importer 2021-08-20 00:58:49 PDT
<rdar://problem/82160691>
Comment 2 Jean-Yves Avenard [:jya] 2021-09-07 19:19:20 PDT
Created attachment 437580 [details]
Patch
Comment 3 Eric Carlson 2021-09-08 09:42:28 PDT
Comment on attachment 437580 [details]
Patch

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

> Source/WebCore/platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:175
> +        setVorbisChannelMap(layout, cookie.channelCount);

Why do you set the *Vorbis* channel map with an Opus cookie? A comment would be helpful.
Comment 4 Jean-Yves Avenard [:jya] 2021-09-08 15:41:45 PDT
Comment on attachment 437580 [details]
Patch

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

> Source/WebCore/platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:176
> +        m_channelLayout = layout;

https://datatracker.ietf.org/doc/html/rfc7845#section-5.1.1.2

mapping family one uses the vorbis layout.
Comment 5 Eric Carlson 2021-09-09 08:32:00 PDT
Comment on attachment 437580 [details]
Patch

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

>> Source/WebCore/platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:176
>> +        m_channelLayout = layout;
> 
> https://datatracker.ietf.org/doc/html/rfc7845#section-5.1.1.2
> 
> mapping family one uses the vorbis layout.

Yes, my point is that someone unfamiliar with the RFC may be confused by code so a comment would be helpful.
Comment 6 Derk-Jan Hartman 2022-03-24 16:15:33 PDT
This problem still exists:
Example: https://upload.wikimedia.org/wikipedia/commons/d/d3/Elephants_Dream_%282006%29.120p.vp9.opus.multichannel.webm

No downsampling occurs and video playback fails. Because canPlayType passes, no fallback can occur to another source (like webm vp8, vorbis) either, creating a broken experience for the user.

This is unfortunate as multichannel is supported by the format and it means that for Wikimedia we will now have to downsample all our derivatives/transcodes to stereo, if we do not want such files to break on macOS. This denies users of Chrome and Firefox the benefit of proper multichannel sound.

Last tested on Safari 15.4 and STP 142, macOS 12.3 on a MacBook Pro from 2021.
Wikimedia ticket: https://phabricator.wikimedia.org/T304624
Comment 7 Jean-Yves Avenard [:jya] 2022-03-24 19:42:34 PDT
(In reply to Derk-Jan Hartman from comment #6)
> This problem still exists:
> Example:
> https://upload.wikimedia.org/wikipedia/commons/d/d3/
> Elephants_Dream_%282006%29.120p.vp9.opus.multichannel.webm
> 

It still exists because it hasn’t been fixed. 

The framework decoder unfortunately lacks the ability to decode more than 2 channels file
Comment 8 Alexey Proskuryakov 2023-11-25 13:53:33 PST
*** Bug 241220 has been marked as a duplicate of this bug. ***