Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c3244cf76da410fe534f880686d375e1390bbbfd
      
https://github.com/WebKit/WebKit/commit/c3244cf76da410fe534f880686d375e1390bbbfd
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-27 (Mon, 27 Jul 2026)

  Changed paths:
    A LayoutTests/webaudio/decode-audio-data-m4a-no-mp4-brand-expected.txt
    A LayoutTests/webaudio/decode-audio-data-m4a-no-mp4-brand.html
    A LayoutTests/webaudio/resources/media/m4a-no-mp4-brand.m4a
    M Source/WebCore/platform/audio/cocoa/AudioFileReaderCocoa.mm

  Log Message:
  -----------
  REGRESSION (iOS 27 beta): AudioContext.decodeAudioData() fails with 
EncodingError on valid AAC/M4A file containing an edit list
https://bugs.webkit.org/show_bug.cgi?id=320198
rdar://183148186

Reviewed by Jer Noble.

Since 2cfd74cacfc8 switched AudioFileReader from AudioToolbox's AudioFile to an
AVAssetReader, decoding is conditional on WebKit resolving a MIME type itself:
demuxAVFData() first sniffs the content, then falls back to AudioFile's 
file-type
detection, and returns nullptr if neither produces one.

Per the MIME sniffing spec, an ISO-BMFF file is only reported as MP4 when the 
major
brand or one of the compatible brands in the ftyp box begins with "mp4". Plenty 
of
valid M4A files carry other brands -- "M4A "/"isom"/"iso2" is what CoreAudio and
several common encoders emit -- so sniffing yields nothing for them. The 
fallback
then fails too, because mimeTypeFor() has no case for the ISO-BMFF file types 
and
drops through to default:, logging a fault and returning an empty string. 
Decoding
is rejected with EncodingError before AVFoundation is ever given the data.

Handle kAudioFileMPEG4Type, kAudioFileM4AType and kAudioFileM4BType as 
"audio/mp4",
and kAudioFile3GPType and kAudioFile3GP2Type as "audio/3gpp" and "audio/3gpp2"
respectively. AudioFile has already parsed the container to determine these, so 
its
answer is authoritative where the sniffer's brand check is not.

The new test uses a one-second mono AAC-LC M4A whose brands are "M4A 
"/"iso2"/"isom"
and which therefore fails to sniff as MP4. Frame count is compared with a 
tolerance
because the number of frames trimmed for encoder delay is decoder-dependent.

* Source/WebCore/platform/audio/cocoa/AudioFileReaderCocoa.mm:
(WebCore::mimeTypeFor):
* LayoutTests/webaudio/decode-audio-data-m4a-no-mp4-brand-expected.txt: Added.
* LayoutTests/webaudio/decode-audio-data-m4a-no-mp4-brand.html: Added.
* LayoutTests/webaudio/resources/media/m4a-no-mp4-brand.m4a: Added.

Canonical link: https://commits.webkit.org/318005@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to