Bug 1301518 - Support mapping family 255 when playing an Opus file, for use with the Web Audio API. r?jya draft
authorPaul Adenot <paul@paul.cx>
Fri, 09 Sep 2016 16:56:17 +0200
changeset 412209 42025be4d74fa4195f2b36b71c4635fc7ea44d15
parent 412181 1fd9f3006c79c281aeb8ad0edbc0110c567274ba
child 530894 36107854b5d6f777982e4d381c5768bfd2de1171
push id29073
push userpaul@paul.cx
push dateFri, 09 Sep 2016 14:56:38 +0000
reviewersjya
bugs1301518
milestone51.0a1
Bug 1301518 - Support mapping family 255 when playing an Opus file, for use with the Web Audio API. r?jya MozReview-Commit-ID: 6beRRFXaHpZ
dom/media/ogg/OpusParser.cpp
--- a/dom/media/ogg/OpusParser.cpp
+++ b/dom/media/ogg/OpusParser.cpp
@@ -81,27 +81,29 @@ bool OpusParser::DecodeHeader(unsigned c
         OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for"
                            " mapping family 0.", mChannels));
         return false;
       }
       mStreams = 1;
       mCoupledStreams = mChannels - 1;
       mMappingTable[0] = 0;
       mMappingTable[1] = 1;
-    } else if (mChannelMapping == 1) {
-      // Currently only up to 8 channels are defined for mapping family 1
+    } else if (mChannelMapping == 1 || mChannelMapping == 255) {
+      // Currently only up to 8 channels are defined for mapping family 1 and
+      // 255.
       if (mChannels>8) {
         OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for"
                            " mapping family 1.", mChannels));
         return false;
       }
       if (aLength>static_cast<unsigned>(20+mChannels)) {
         mStreams = aData[19];
         mCoupledStreams = aData[20];
         int i;
+        MOZ_ASSERT(mChannels < 255);
         for (i=0; i<mChannels; i++)
           mMappingTable[i] = aData[21+i];
       } else {
         OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: channel mapping %d,"
                            " but no channel mapping table", mChannelMapping));
         return false;
       }
     } else {