bug 1172979 permit retrieving const channel data from const AudioChunk r?padenot draft
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 10 Aug 2017 17:03:15 +1200
changeset 646085 5a78dea62dc52ca52fc207f98383b4a0cd57b6a8
parent 646084 63a25de134e0cb6a710776a947d8ccdca91df5ff
child 646086 d9fe421dd0d2b4d234beb685086761df62d5c539
push id74001
push userktomlinson@mozilla.com
push dateMon, 14 Aug 2017 21:14:48 +0000
reviewerspadenot
bugs1172979
milestone57.0a1
bug 1172979 permit retrieving const channel data from const AudioChunk r?padenot MozReview-Commit-ID: 8mP49nONMYI
dom/media/AudioSegment.h
--- a/dom/media/AudioSegment.h
+++ b/dom/media/AudioSegment.h
@@ -216,20 +216,20 @@ struct AudioChunk {
     }
 
     // Memory in the array is owned by mBuffer.
     amount += mChannelData.ShallowSizeOfExcludingThis(aMallocSizeOf);
     return amount;
   }
 
   template<typename T>
-  const nsTArray<const T*>& ChannelData()
+  const nsTArray<const T*>& ChannelData() const
   {
     MOZ_ASSERT(AudioSampleTypeToFormat<T>::Format == mBufferFormat);
-    return *reinterpret_cast<nsTArray<const T*>*>(&mChannelData);
+    return *reinterpret_cast<const nsTArray<const T*>*>(&mChannelData);
   }
 
   PrincipalHandle GetPrincipalHandle() const { return mPrincipalHandle; }
 
   StreamTime mDuration; // in frames within the buffer
   RefPtr<ThreadSharedObject> mBuffer; // the buffer object whose lifetime is managed; null means data is all zeroes
   nsTArray<const void*> mChannelData; // one pointer per channel; empty if and only if mBuffer is null
   float mVolume; // volume multiplier to apply (1.0f if mBuffer is nonnull)