Repository navigation
Commit ffc83d5
committed
Implement audio decoding supports to MediaSamplesDecoder
https://bugs.webkit.org/show_bug.cgi?id=327758
rdar://190173646
Reviewed by NOBODY (OOPS!).
MediaSamplesDecoder was a skeleton whose methods were placeholders. It now
decodes audio in the content process by wrapping AudioDecoder, for every codec
AudioDecoder accepts: Opus, Vorbis, FLAC, MP3, AAC (LC, HE, HE v2), A-law,
u-law and PCM. The decoded output is one MediaSamplesBlock of interleaved
32-bit float samples per call, backed by shared memory when UseSharedMemory is
set. The AAC cookie of a track built from a format description is an
ES_Descriptor, which is unwrapped to the AudioSpecificConfig AudioDecoder
expects. Encrypted tracks, and blocks holding encrypted samples, are rejected.
Only Cocoa is supported for now; other platforms and video report that they
cannot decode.
MediaSamplesBlock gains isolatedCopy() as NativePromise copies its resolve
value across threads.
* Source/WebCore/platform/MediaSamplesBlock.h:
(WebCore::MediaSamplesBlock::isolatedCopy):
* Source/WebCore/platform/MediaSamplesDecoder.cpp:
(WebCore::nextDescriptor): Added.
(WebCore::audioSpecificConfigFromESDescriptor): Added.
(WebCore::audioDecoderConfiguration): Added.
(WebCore::MediaSamplesDecoder::MediaSamplesDecoder):
(WebCore::MediaSamplesDecoder::~MediaSamplesDecoder):
(WebCore::MediaSamplesDecoder::canDecode):
(WebCore::MediaSamplesDecoder::create):
(WebCore::MediaSamplesDecoder::canContinueWith):
(WebCore::MediaSamplesDecoder::decode):
(WebCore::MediaSamplesDecoder::drain):
(WebCore::MediaSamplesDecoder::flush):
(WebCore::MediaSamplesDecoder::decodeOnQueue): Added.
(WebCore::MediaSamplesDecoder::drainOnQueue): Added.
(WebCore::MediaSamplesDecoder::flushOnQueue): Added.
(WebCore::MediaSamplesDecoder::finishFlush): Added.
(WebCore::MediaSamplesDecoder::settleWithPendingOutput): Added.
(WebCore::MediaSamplesDecoder::setAudioDecoder): Added.
(WebCore::MediaSamplesDecoder::didFailDecoding): Added.
(WebCore::MediaSamplesDecoder::didDecodeAudio): Added.
* Source/WebCore/platform/MediaSamplesDecoder.h:
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/MediaSamplesDecoderTests.mm: Added.1 parent 5a73a28 commit ffc83d5
6 files changed
Lines changed: 860 additions & 27 deletions
File tree
- Source/WebCore/platform
- Tools/TestWebKitAPI
- TestWebKitAPI.xcodeproj
- Tests/WebCore/cocoa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
0 commit comments