Bug 1220558. Part 1 - remove unused arguments from MediaDecoderReader::DispatchNotifyDataArrived() and its callees/callers. r=jya.

This commit is contained in:
JW Wang 2015-11-11 07:43:38 +08:00
Родитель 8f0ce84f5b
Коммит 4f2d0e76bc
11 изменённых файлов: 19 добавлений и 42 удалений

Просмотреть файл

@ -111,8 +111,7 @@ public:
// Called by the reader's MediaResource as data arrives over the network.
// Must be called on the main thread.
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset,
bool aThrottleUpdates) = 0;
virtual void NotifyDataArrived(bool aThrottleUpdates) = 0;
// Set by Reader if the current audio track can be offloaded
virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) {}

Просмотреть файл

@ -1341,13 +1341,11 @@ void MediaDecoder::AddSizeOfResources(ResourceSizes* aSizes) {
}
void
MediaDecoder::NotifyDataArrived(uint32_t aLength,
int64_t aOffset,
bool aThrottleUpdates) {
MediaDecoder::NotifyDataArrived(bool aThrottleUpdates) {
MOZ_ASSERT(NS_IsMainThread());
if (mDecoderStateMachine) {
mDecoderStateMachine->DispatchNotifyDataArrived(aLength, aOffset, aThrottleUpdates);
mDecoderStateMachine->DispatchNotifyDataArrived(aThrottleUpdates);
}
// ReadyState computation depends on MediaDecoder::CanPlayThrough, which

Просмотреть файл

@ -433,8 +433,7 @@ public:
// Called as data arrives on the stream and is read into the cache. Called
// on the main thread only.
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset,
bool aThrottleUpdates) override;
virtual void NotifyDataArrived(bool aThrottleUpdates) override;
// Called by MediaResource when the principal of the resource has
// changed. Called on main thread only.

Просмотреть файл

@ -183,22 +183,11 @@ MediaDecoderReader::UpdateBuffered()
}
void
MediaDecoderReader::ThrottledNotifyDataArrived(const Interval<int64_t>& aInterval)
MediaDecoderReader::ThrottledNotifyDataArrived()
{
MOZ_ASSERT(OnTaskQueue());
NS_ENSURE_TRUE_VOID(!mShutdown);
if (mThrottledInterval.isNothing()) {
mThrottledInterval.emplace(aInterval);
} else if (mThrottledInterval.ref().Contains(aInterval)) {
return;
} else if (!mThrottledInterval.ref().Contiguous(aInterval)) {
DoThrottledNotify();
mThrottledInterval.emplace(aInterval);
} else {
mThrottledInterval = Some(mThrottledInterval.ref().Span(aInterval));
}
// If it's been long enough since our last update, do it.
if (TimeStamp::Now() - mLastThrottledNotify > mThrottleDuration) {
DoThrottledNotify();
@ -227,9 +216,7 @@ MediaDecoderReader::DoThrottledNotify()
MOZ_ASSERT(OnTaskQueue());
mLastThrottledNotify = TimeStamp::Now();
mThrottledNotify.DisconnectIfExists();
Interval<int64_t> interval = mThrottledInterval.ref();
mThrottledInterval.reset();
NotifyDataArrived(interval);
NotifyDataArrived();
}
media::TimeIntervals

Просмотреть файл

@ -229,22 +229,18 @@ public:
// throttling when the update comes from MSE code, since that code needs the
// updates to be observable immediately, and is generally less
// trigger-happy with notifications anyway.
void DispatchNotifyDataArrived(uint32_t aLength,
int64_t aOffset,
bool aThrottleUpdates)
void DispatchNotifyDataArrived(bool aThrottleUpdates)
{
typedef media::Interval<int64_t> Interval;
RefPtr<nsRunnable> r = NS_NewRunnableMethodWithArg<Interval>(
RefPtr<nsRunnable> r = NS_NewRunnableMethod(
this,
aThrottleUpdates ? &MediaDecoderReader::ThrottledNotifyDataArrived :
&MediaDecoderReader::NotifyDataArrived,
Interval(aOffset, aOffset + aLength));
&MediaDecoderReader::NotifyDataArrived);
OwnerThread()->Dispatch(
r.forget(), AbstractThread::DontAssertDispatchSuccess);
}
void NotifyDataArrived(const media::Interval<int64_t>& aInfo)
void NotifyDataArrived()
{
MOZ_ASSERT(OnTaskQueue());
NS_ENSURE_TRUE_VOID(!mShutdown);
@ -422,7 +418,7 @@ private:
// Invokes NotifyDataArrived while throttling the calls to occur
// at most every mThrottleDuration ms.
void ThrottledNotifyDataArrived(const media::Interval<int64_t>& aInterval);
void ThrottledNotifyDataArrived();
void DoThrottledNotify();
// Overrides of this function should decodes an unspecified amount of

Просмотреть файл

@ -168,9 +168,9 @@ public:
OwnerThread()->Dispatch(runnable.forget());
}
void DispatchNotifyDataArrived(uint32_t aLength, int64_t aOffset, bool aThrottleUpdates)
void DispatchNotifyDataArrived(bool aThrottleUpdates)
{
mReader->DispatchNotifyDataArrived(aLength, aOffset, aThrottleUpdates);
mReader->DispatchNotifyDataArrived(aThrottleUpdates);
}
// Notifies the state machine that should minimize the number of samples

Просмотреть файл

@ -455,8 +455,7 @@ ChannelMediaResource::CopySegmentToCache(nsIInputStream *aInStream,
{
CopySegmentClosure* closure = static_cast<CopySegmentClosure*>(aClosure);
closure->mResource->mCallback->NotifyDataArrived(aCount, closure->mResource->mOffset,
/* aThrottleUpdates = */ true);
closure->mResource->mCallback->NotifyDataArrived(/* aThrottleUpdates = */ true);
// Keep track of where we're up to.
RESOURCE_LOG("%p [ChannelMediaResource]: CopySegmentToCache at mOffset [%lld] add "

Просмотреть файл

@ -49,8 +49,7 @@ public:
virtual void NotifyDecodeError() {}
// Notify that data arrives on the stream and is read into the cache.
virtual void NotifyDataArrived(
uint32_t aLength, int64_t aOffset, bool aThrottleUpdates) {}
virtual void NotifyDataArrived(bool aThrottleUpdates) {}
// Notify that MediaResource has received some data.
virtual void NotifyBytesDownloaded() {}

Просмотреть файл

@ -301,7 +301,7 @@ SourceBuffer::Ended()
mContentManager->Ended();
// We want the MediaSourceReader to refresh its buffered range as it may
// have been modified (end lined up).
mMediaSource->GetDecoder()->NotifyDataArrived(1, mReportedOffset++, /* aThrottleUpdates = */ false);
mMediaSource->GetDecoder()->NotifyDataArrived(/* aThrottleUpdates = */ false);
}
SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
@ -484,7 +484,7 @@ SourceBuffer::AppendDataCompletedWithSuccess(bool aHasActiveTracks)
// Tell our parent decoder that we have received new data.
// The information provided do not matter much so long as it is monotonically
// increasing.
mMediaSource->GetDecoder()->NotifyDataArrived(1, mReportedOffset++, /* aThrottleUpdates = */ false);
mMediaSource->GetDecoder()->NotifyDataArrived(/* aThrottleUpdates = */ false);
// Send progress event.
mMediaSource->GetDecoder()->NotifyBytesDownloaded();
}

Просмотреть файл

@ -96,7 +96,7 @@ private:
while (mLength) {
uint32_t length = std::min<uint64_t>(mLength, UINT32_MAX);
mOmxReader->NotifyDataArrived(Interval<int64_t>(mOffset, mOffset + length));
mOmxReader->NotifyDataArrived();
mLength -= length;
mOffset += length;
}

Просмотреть файл

@ -57,7 +57,7 @@ public:
virtual MediaDecoderOwner* GetOwner() final override;
virtual void NotifyDataArrived(uint32_t, int64_t, bool) final override {};
virtual void NotifyDataArrived(bool) final override {};
private:
virtual ~BufferDecoder();