Bug 1151299: Part2. Clear EOS flag when new data is received. r=mattwoodrow

We will reattempt to demux samples in a followup call, which may re-set EOS.
This commit is contained in:
Jean-Yves Avenard 2015-04-07 20:33:17 +10:00
Родитель 51a0437eb8
Коммит a3d318782c
2 изменённых файлов: 38 добавлений и 0 удалений

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

@ -158,6 +158,7 @@ MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder)
, mIsEncrypted(false)
, mAreDecodersSetup(false)
, mIndexReady(false)
, mLastSeenEnd(-1)
, mDemuxerMonitor("MP4 Demuxer")
#if defined(MP4_READER_DORMANT_HEURISTIC)
, mDormantEnabled(Preferences::GetBool("media.decoder.heuristic.dormant.enabled", false))
@ -1158,4 +1159,39 @@ MP4Reader::VideoIsHardwareAccelerated() const
return mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated();
}
void
MP4Reader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset)
{
MOZ_ASSERT(NS_IsMainThread());
if (mShutdown) {
return;
}
if (mLastSeenEnd < 0) {
MonitorAutoLock mon(mDemuxerMonitor);
mLastSeenEnd = mDecoder->GetResource()->GetLength();
if (mLastSeenEnd < 0) {
// We dont have a length. Demuxer would have been blocking already.
return;
}
}
int64_t end = aOffset + aLength;
if (end <= mLastSeenEnd) {
return;
}
mLastSeenEnd = end;
if (HasVideo()) {
auto& decoder = GetDecoderData(kVideo);
MonitorAutoLock lock(decoder.mMonitor);
decoder.mDemuxEOS = false;
}
if (HasAudio()) {
auto& decoder = GetDecoderData(kAudio);
MonitorAutoLock lock(decoder.mMonitor);
decoder.mDemuxEOS = false;
}
}
} // namespace mozilla

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

@ -77,6 +77,7 @@ public:
virtual bool IsMediaSeekable() override;
virtual int64_t GetEvictionOffset(double aTime) override;
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset) override;
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered) override;
@ -287,6 +288,7 @@ private:
bool mAreDecodersSetup;
bool mIndexReady;
int64_t mLastSeenEnd;
Monitor mDemuxerMonitor;
nsRefPtr<SharedDecoderManager> mSharedDecoderManager;