Bug 1444479 - P7. Allow Apple AudioToolbox decoder handle more than 8 channels. r?padenot draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 16 Mar 2018 16:57:01 +0100
changeset 769400 b7ea9357d3853921f47e3dd2c5ea680e7b3a17b2
parent 769399 3e58f138c164179245e47e3f15f7d9750c521e67
child 769401 36c478c12c72f785ef3a2bff93d31baa43def806
push id103110
push userbmo:jyavenard@mozilla.com
push dateMon, 19 Mar 2018 14:36:56 +0000
reviewerspadenot
bugs1444479
milestone61.0a1
Bug 1444479 - P7. Allow Apple AudioToolbox decoder handle more than 8 channels. r?padenot Apple layout standard has a 1:1 equivalence with the WAVE standard. As such, any streams under 18 channels, properly defining a channel layout, should play on all platform. Otherwise, as Opus and Vorbis, the result will be platform dependent. MozReview-Commit-ID: ID6b9u2UNQr
dom/media/platforms/apple/AppleATDecoder.cpp
--- a/dom/media/platforms/apple/AppleATDecoder.cpp
+++ b/dom/media/platforms/apple/AppleATDecoder.cpp
@@ -308,23 +308,19 @@ AppleATDecoder::DecodeSample(MediaRawDat
       duration.ToSeconds());
 #endif
 
   AudioSampleBuffer data(outputData.Elements(), outputData.Length());
   if (!data.Data()) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   if (mChannelLayout && !mAudioConverter) {
-    AudioConfig in(*mChannelLayout, rate);
+    AudioConfig in(*mChannelLayout, channels, rate);
     AudioConfig out(AudioConfig::ChannelLayout::SMPTEDefault(*mChannelLayout),
-                    rate);
-    if (!in.IsValid() || !out.IsValid()) {
-      return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
-                         RESULT_DETAIL("Invalid audio config"));
-    }
+                    channels, rate);
     mAudioConverter = MakeUnique<AudioConverter>(in, out);
   }
   if (mAudioConverter) {
     MOZ_ASSERT(mAudioConverter->CanWorkInPlace());
     data = mAudioConverter->Process(Move(data));
   }
 
   RefPtr<AudioData> audio =