From 17e4b1d7d86de06106f31ddc91fd42d299528e2b Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 31 May 2016 14:18:58 +0800 Subject: [PATCH] Bug 1276851 - Remove AudioStream::mIsFirst. r=kinetik. MozReview-Commit-ID: H9KCM2zZulA --HG-- extra : rebase_source : 51387a1bd37f1b22bdb5100abe83af17c0caa481 --- dom/media/AudioStream.cpp | 11 ++++++----- dom/media/AudioStream.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index b29a504007aa..51bea8a2898a 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -327,7 +327,7 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, const dom::AudioChannel aAudioChannel) { auto startTime = TimeStamp::Now(); - mIsFirst = CubebUtils::GetFirstStream(); + auto isFirst = CubebUtils::GetFirstStream(); LOG("%s channels: %d, rate: %d", __FUNCTION__, aNumChannels, aRate); mInRate = mOutRate = aRate; @@ -354,11 +354,12 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, params.format = ToCubebFormat::value; mAudioClock.Init(); - return OpenCubeb(params, startTime); + return OpenCubeb(params, startTime, isFirst); } nsresult -AudioStream::OpenCubeb(cubeb_stream_params &aParams, TimeStamp aStartTime) +AudioStream::OpenCubeb(cubeb_stream_params& aParams, + TimeStamp aStartTime, bool aIsFirst) { cubeb* cubebContext = CubebUtils::GetCubebContext(); if (!cubebContext) { @@ -378,9 +379,9 @@ AudioStream::OpenCubeb(cubeb_stream_params &aParams, TimeStamp aStartTime) } TimeDuration timeDelta = TimeStamp::Now() - aStartTime; - LOG("creation time %sfirst: %u ms", mIsFirst ? "" : "not ", + LOG("creation time %sfirst: %u ms", aIsFirst ? "" : "not ", (uint32_t) timeDelta.ToMilliseconds()); - Telemetry::Accumulate(mIsFirst ? Telemetry::AUDIOSTREAM_FIRST_OPEN_MS : + Telemetry::Accumulate(aIsFirst ? Telemetry::AUDIOSTREAM_FIRST_OPEN_MS : Telemetry::AUDIOSTREAM_LATER_OPEN_MS, timeDelta.ToMilliseconds()); return NS_OK; diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index 7942ecc57b60..f41ef862a501 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -313,7 +313,8 @@ protected: int64_t GetPositionInFramesUnlocked(); private: - nsresult OpenCubeb(cubeb_stream_params &aParams, TimeStamp aStartTime); + nsresult OpenCubeb(cubeb_stream_params& aParams, + TimeStamp aStartTime, bool aIsFirst); static long DataCallback_S(cubeb_stream*, void* aThis, const void* /* aInputBuffer */, void* aOutputBuffer, @@ -371,7 +372,6 @@ private: }; StreamState mState; - bool mIsFirst; DataSource& mDataSource; };