Bug 1432779 - P1. Fix ChannelLayout calculation for uncommon layouts. r=padenot
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 09 Mar 2018 13:44:11 +0100
changeset 409777 355c35d358fb2669f5aaf7c450d03817595f4ab6
parent 409776 0b1a55a9b166defe144d6b11a8e4adff29709a5a
child 409778 075811af8d4aeaa4f4895917fc49d66f8026d3b0
push id101310
push userjyavenard@mozilla.com
push dateSat, 24 Mar 2018 10:08:45 +0000
treeherdermozilla-inbound@8d4c3cf648d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1432779
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1432779 - P1. Fix ChannelLayout calculation for uncommon layouts. r=padenot MozReview-Commit-ID: Fi5ESBhziOp
dom/media/AudioConfig.cpp
--- a/dom/media/AudioConfig.cpp
+++ b/dom/media/AudioConfig.cpp
@@ -215,26 +215,27 @@ AudioConfig::ChannelLayout::SMPTEDefault
                             CHANNEL_BACK_LEFT,    CHANNEL_BACK_RIGHT,
                             CHANNEL_SIDE_LEFT,    CHANNEL_SIDE_RIGHT };
     default:
       break;
   }
   AutoTArray<Channel, MAX_AUDIO_CHANNELS> layout;
   uint32_t channels = 0;
 
-  uint32_t i = 1;
+  uint32_t i = 0;
   while (aMap) {
     if (aMap & 1) {
       layout.AppendElement(static_cast<Channel>(i));
       channels++;
       if (channels > MAX_AUDIO_CHANNELS) {
         return ChannelLayout();
       }
     }
     aMap >>= 1;
+    i++;
   }
   return ChannelLayout(channels, layout.Elements());
 }
 
 bool
 AudioConfig::ChannelLayout::MappingTable(const ChannelLayout& aOther,
                                          uint8_t* aMap) const
 {