Bug 1533612 - Change to unsigned int to avoid integer overflow. r=jya
authorAlex Chronopoulos <achronop@gmail.com>
Thu, 14 Mar 2019 04:11:39 +0000
changeset 521857 814b2ae9ef66813cffc762db0353db2d0744fd81
parent 521856 f3946ac225814d2db253de0c11c08c698fa88dfc
child 521858 bfb30a402bceee67aea0901ff7da70431d9897ce
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1533612
milestone67.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 1533612 - Change to unsigned int to avoid integer overflow. r=jya mProcessedQueueLength is int32_t (wrapped around an Atomic) but it is updated from the method FramesToUsecs() which returns int64_t (wrapped around a CheckedInt) thus it is changed to unsigned int to avoid integer overflow. Differential Revision: https://phabricator.services.mozilla.com/D22949
dom/media/mediasink/AudioSink.h
--- a/dom/media/mediasink/AudioSink.h
+++ b/dom/media/mediasink/AudioSink.h
@@ -127,17 +127,17 @@ class AudioSink : private AudioStream::D
   already_AddRefed<AudioData> CreateAudioFromBuffer(
       AlignedAudioBuffer&& aBuffer, AudioData* aReference);
   // Add data to the processsed queue, update mProcessedQueueLength and
   // return the number of frames added.
   uint32_t PushProcessedAudio(AudioData* aData);
   UniquePtr<AudioConverter> mConverter;
   MediaQueue<AudioData> mProcessedQueue;
   // Length in microseconds of the ProcessedQueue
-  Atomic<int32_t> mProcessedQueueLength;
+  Atomic<uint64_t> mProcessedQueueLength;
   MediaEventListener mAudioQueueListener;
   MediaEventListener mAudioQueueFinishListener;
   MediaEventListener mProcessedQueueListener;
   // Number of frames processed from mAudioQueue. Used to determine gaps in
   // the input stream. It indicates the time in frames since playback started
   // at the current input framerate.
   int64_t mFramesParsed;
   Maybe<RefPtr<AudioData>> mLastProcessedPacket;