Bug 1422657. P2 - remove unused mDecoderPosition and related code. r=bechen,gerald

MozReview-Commit-ID: 8RobmJKC40i

--HG--
extra : rebase_source : 2b9abaa1a22b78cadbbdbf99d1c778fe82f84eac
extra : source : 7267883c2b722f806fc11c35ff9c8c5743a57bf3
This commit is contained in:
JW Wang 2017-12-01 14:02:44 +08:00
Родитель d72cfc05d2
Коммит 32ec06ebb2
8 изменённых файлов: 1 добавлений и 86 удалений

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

@ -159,13 +159,4 @@ BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
}
}
void
BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset)
{
if (aNumBytes <= 0) {
return;
}
mCallback->NotifyBytesConsumed(aNumBytes, aOffset);
}
} // namespace mozilla

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

@ -133,10 +133,6 @@ protected:
// then the request is added back to the load group.
void ModifyLoadFlags(nsLoadFlags aFlags);
// Dispatches an event to call MediaDecoder::NotifyBytesConsumed(aNumBytes, aOffset)
// on the main thread. This is called automatically after every read.
void DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset);
RefPtr<MediaResourceCallback> mCallback;
// Channel used to download the media data. Must be accessed

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

@ -170,30 +170,11 @@ ChannelMediaDecoder::ResourceCallback::NotifySuspendedStatusChanged(
}
}
void
ChannelMediaDecoder::ResourceCallback::NotifyBytesConsumed(int64_t aBytes,
int64_t aOffset)
{
RefPtr<ResourceCallback> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"ChannelMediaDecoder::ResourceCallback::NotifyBytesConsumed",
[=]() {
if (self->mDecoder) {
self->mDecoder->NotifyBytesConsumed(aBytes, aOffset);
}
});
mAbstractMainThread->Dispatch(r.forget());
}
ChannelMediaDecoder::ChannelMediaDecoder(MediaDecoderInit& aInit)
: MediaDecoder(aInit)
, mResourceCallback(new ResourceCallback(aInit.mOwner->AbstractMainThread()))
, mWatchManager(this, aInit.mOwner->AbstractMainThread())
{
mResourceCallback->Connect(this);
// mIgnoreProgressData
mWatchManager.Watch(mLogicallySeeking, &ChannelMediaDecoder::SeekingChanged);
}
/* static */
@ -260,7 +241,6 @@ MediaDecoderStateMachine* ChannelMediaDecoder::CreateStateMachine()
void
ChannelMediaDecoder::Shutdown()
{
mWatchManager.Shutdown();
mResourceCallback->Disconnect();
MediaDecoder::Shutdown();
@ -349,30 +329,6 @@ ChannelMediaDecoder::NotifyDownloadEnded(nsresult aStatus)
}
}
void
ChannelMediaDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
AbstractThread::AutoEnter context(AbstractMainThread());
if (mIgnoreProgressData) {
return;
}
MOZ_ASSERT(GetStateMachine());
mDecoderPosition = aOffset + aBytes;
}
void
ChannelMediaDecoder::SeekingChanged()
{
// Stop updating the bytes downloaded for progress notifications when
// seeking to prevent wild changes to the progress notification.
MOZ_ASSERT(NS_IsMainThread());
mIgnoreProgressData = mLogicallySeeking;
}
bool
ChannelMediaDecoder::CanPlayThroughImpl()
{

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

@ -50,7 +50,6 @@ class ChannelMediaDecoder
void NotifyDataEnded(nsresult aStatus) override;
void NotifyPrincipalChanged() override;
void NotifySuspendedStatusChanged(bool aSuspendedByCache) override;
void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) override;
static void TimerCallback(nsITimer* aTimer, void* aClosure);
@ -121,8 +120,6 @@ private:
// by the MediaResource read functions.
void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset);
void SeekingChanged();
bool CanPlayThroughImpl() override final;
bool IsLiveStream() override final;
@ -147,14 +144,6 @@ private:
bool ShouldThrottleDownload(const MediaStatistics& aStats);
WatchManager<ChannelMediaDecoder> mWatchManager;
// True when seeking or otherwise moving the play position around in
// such a manner that progress event data is inaccurate. This is set
// during seek and duration operations to prevent the progress indicator
// from jumping around. Read/Write on the main thread only.
bool mIgnoreProgressData = false;
// Data needed to estimate playback data rate. The timeline used for
// this estimate is "decode time" (where the "current time" is the
// time of the last decoded video frame).

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

@ -621,12 +621,7 @@ nsresult ChannelMediaResource::ReadAt(int64_t aOffset,
uint32_t* aBytes)
{
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
nsresult rv = mCacheStream.ReadAt(aOffset, aBuffer, aCount, aBytes);
if (NS_SUCCEEDED(rv)) {
DispatchBytesConsumed(*aBytes, aOffset);
}
return rv;
return mCacheStream.ReadAt(aOffset, aBuffer, aCount, aBytes);
}
void

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

@ -171,9 +171,6 @@ FileMediaResource::ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount,
if (NS_FAILED(rv)) return rv;
rv = UnsafeRead(aBuffer, aCount, aBytes);
}
if (NS_SUCCEEDED(rv)) {
DispatchBytesConsumed(*aBytes, aOffset);
}
return rv;
}

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

@ -652,12 +652,6 @@ protected:
// background.
bool mIsBackgroundVideoDecodingAllowed;
// Current decoding position in the stream. This is where the decoder
// is up to consuming the stream. This is not adjusted during decoder
// seek operations, but it's updated at the end when we start playing
// back again.
int64_t mDecoderPosition = 0;
public:
AbstractCanonical<double>* CanonicalVolume() { return &mVolume; }
AbstractCanonical<bool>* CanonicalPreservesPitch()

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

@ -58,9 +58,6 @@ public:
// Notify that the "cache suspended" status of MediaResource changes.
virtual void NotifySuspendedStatusChanged(bool aSuspendedByCache) {}
// Notify the number of bytes read from the resource.
virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) {}
protected:
virtual ~MediaResourceCallback() {}
};