mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1163227
: Part2. Add MediaDecoderReader::NotifyDataRemoved method. r=cpearce
This commit is contained in:
parent
7801d65945
commit
da404110e2
@ -85,6 +85,12 @@ public:
|
||||
// data is available.
|
||||
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset) { }
|
||||
|
||||
// Notifies the demuxer that the underlying resource has had data removed.
|
||||
// The demuxer can use this mechanism to inform all track demuxers to update
|
||||
// its TimeIntervals.
|
||||
// This will be called should the demuxer be used with MediaSource.
|
||||
virtual void NotifyDataRemoved() { }
|
||||
|
||||
protected:
|
||||
virtual ~MediaDataDemuxer()
|
||||
{
|
||||
|
@ -247,6 +247,8 @@ public:
|
||||
// Only used by WebMReader and MediaOmxReader for now, so stub here rather
|
||||
// than in every reader than inherits from MediaDecoderReader.
|
||||
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset) {}
|
||||
// Notify the reader that data from the resource was evicted (MediaSource only)
|
||||
virtual void NotifyDataRemoved() {}
|
||||
virtual int64_t GetEvictionOffset(double aTime) { return -1; }
|
||||
|
||||
virtual MediaQueue<AudioData>& AudioQueue() { return mAudioQueue; }
|
||||
|
@ -1334,7 +1334,11 @@ MediaFormatReader::NotifyDemuxer(uint32_t aLength, int64_t aOffset)
|
||||
return;
|
||||
}
|
||||
|
||||
mDemuxer->NotifyDataArrived(aLength, aOffset);
|
||||
if (aLength || aOffset) {
|
||||
mDemuxer->NotifyDataArrived(aLength, aOffset);
|
||||
} else {
|
||||
mDemuxer->NotifyDataRemoved();
|
||||
}
|
||||
if (HasVideo()) {
|
||||
mVideo.mReceivedNewData = true;
|
||||
ScheduleUpdate(TrackType::kVideoTrack);
|
||||
@ -1355,6 +1359,7 @@ MediaFormatReader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, int6
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mMainThreadDemuxer);
|
||||
MOZ_ASSERT(aBuffer || aLength);
|
||||
mMainThreadDemuxer->NotifyDataArrived(aLength, aOffset);
|
||||
|
||||
// Queue a task to notify our main demuxer.
|
||||
@ -1365,4 +1370,24 @@ MediaFormatReader::NotifyDataArrived(const char* aBuffer, uint32_t aLength, int6
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
void
|
||||
MediaFormatReader::NotifyDataRemoved()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mInitDone) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mMainThreadDemuxer);
|
||||
mMainThreadDemuxer->NotifyDataRemoved();
|
||||
|
||||
// Queue a task to notify our main demuxer.
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArgs<int32_t, uint64_t>(
|
||||
this, &MediaFormatReader::NotifyDemuxer,
|
||||
0, 0);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
virtual void NotifyDataArrived(const char* aBuffer,
|
||||
uint32_t aLength,
|
||||
int64_t aOffset) override;
|
||||
virtual void NotifyDataRemoved() override;
|
||||
|
||||
virtual media::TimeIntervals GetBuffered() override;
|
||||
|
||||
|
@ -114,6 +114,14 @@ MP4Demuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MP4Demuxer::NotifyDataRemoved()
|
||||
{
|
||||
for (uint32_t i = 0; i < mDemuxers.Length(); i++) {
|
||||
mDemuxers[i]->NotifyDataArrived();
|
||||
}
|
||||
}
|
||||
|
||||
UniquePtr<EncryptionInfo>
|
||||
MP4Demuxer::GetCrypto()
|
||||
{
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
|
||||
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
|
||||
|
||||
virtual void NotifyDataRemoved() override;
|
||||
|
||||
private:
|
||||
friend class MP4TrackDemuxer;
|
||||
nsRefPtr<MediaResource> mResource;
|
||||
|
Loading…
Reference in New Issue
Block a user