Bug 1504944 - Only re-order channels for opus mapping 1. r=padenot a=jcristau
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 06 Nov 2018 18:11:41 +0000
changeset 501180 072d56f53c88aa83db40ccb4be38226bf24ebddc
parent 501179 c1babc4f5dfc82eaf9edf4377c87d029dd6564c1
child 501181 f3c21b2ef2421f82a0d178489cf45b8eb44f516f
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, jcristau
bugs1504944
milestone64.0
Bug 1504944 - Only re-order channels for opus mapping 1. r=padenot a=jcristau For channel mapping 0 (which is always mono or sterero), the mapping is identical to the SMPTE one, so can copy the mapping as-is. Differential Revision: https://phabricator.services.mozilla.com/D11000
dom/media/platforms/agnostic/OpusDecoder.cpp
--- a/dom/media/platforms/agnostic/OpusDecoder.cpp
+++ b/dom/media/platforms/agnostic/OpusDecoder.cpp
@@ -149,23 +149,23 @@ OpusDataDecoder::DecodeHeader(const unsi
   if (vorbisLayout.IsValid()) {
     mChannelMap = vorbisLayout.Map();
 
     AudioConfig::ChannelLayout smpteLayout(
       AudioConfig::ChannelLayout::SMPTEDefault(vorbisLayout));
 
     AutoTArray<uint8_t, 8> map;
     map.SetLength(channels);
-    if (vorbisLayout.MappingTable(smpteLayout, &map)) {
+    if (mOpusParser->mChannelMapping == 1 &&
+        vorbisLayout.MappingTable(smpteLayout, &map)) {
       for (int i = 0; i < channels; i++) {
         mMappingTable[i] = mOpusParser->mMappingTable[map[i]];
       }
     } else {
-      // Should never get here as vorbis layout is always convertible to SMPTE
-      // default layout.
+      // Use Opus set channel mapping and return channels as-is.
       PodCopy(mMappingTable.Elements(), mOpusParser->mMappingTable, channels);
     }
   } else {
     // Create a dummy mapping table so that channel ordering stay the same
     // during decoding.
     for (int i = 0; i < channels; i++) {
       mMappingTable[i] = i;
     }