Bug 1212176: Remove arguments passed to MediaDataDemuxer::NotifyDataArrived API. r=cpearce

Be more explicit on what it does and how it should be used.
This commit is contained in:
Jean-Yves Avenard 2015-10-07 12:34:32 +11:00
parent 468b7b72d3
commit 628247fc4e
11 changed files with 20 additions and 21 deletions

View File

@ -84,11 +84,10 @@ MP3Demuxer::IsSeekable() const {
}
void
MP3Demuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset) {
MP3Demuxer::NotifyDataArrived() {
// TODO: bug 1169485.
NS_WARNING("Unimplemented function NotifyDataArrived");
MP3DEMUXER_LOGV("NotifyDataArrived(%u, %" PRId64 ") mOffset=%" PRId64,
aLength, aOffset, mTrackDemuxer->GetResourceOffset());
MP3DEMUXER_LOGV("NotifyDataArrived()");
}
void

View File

@ -25,7 +25,7 @@ public:
already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(
TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
bool IsSeekable() const override;
void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
void NotifyDataArrived() override;
void NotifyDataRemoved() override;
// Do not shift the calculated buffered range by the start time of the first
// decoded frame. The mac MP3 decoder will buffer some samples and the first

View File

@ -77,15 +77,17 @@ public:
return nullptr;
}
// Notifies the demuxer that the underlying resource has received more data.
// Notifies the demuxer that the underlying resource has received more data
// since the demuxer was initialized.
// The demuxer can use this mechanism to inform all track demuxers that new
// data is available.
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset) { }
// data is available and to refresh its buffered range.
virtual void NotifyDataArrived() { }
// Notifies the demuxer that the underlying resource has had data removed.
// Notifies the demuxer that the underlying resource has had data removed
// since the demuxer was initialized.
// 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.
// its buffered range.
// This will be called should the demuxer be used with MediaSourceResource.
virtual void NotifyDataRemoved() { }
// Indicate to MediaFormatReader if it should compute the start time

View File

@ -1603,7 +1603,7 @@ MediaFormatReader::NotifyDemuxer(uint32_t aLength, int64_t aOffset)
}
if (aLength || aOffset) {
mDemuxer->NotifyDataArrived(aLength, aOffset);
mDemuxer->NotifyDataArrived();
} else {
mDemuxer->NotifyDataRemoved();
}

View File

@ -186,7 +186,7 @@ MP4Demuxer::IsSeekable() const
}
void
MP4Demuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
MP4Demuxer::NotifyDataArrived()
{
for (uint32_t i = 0; i < mDemuxers.Length(); i++) {
mDemuxers[i]->NotifyDataArrived();

View File

@ -40,7 +40,7 @@ public:
virtual UniquePtr<EncryptionInfo> GetCrypto() override;
virtual void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
virtual void NotifyDataArrived() override;
virtual void NotifyDataRemoved() override;

View File

@ -53,7 +53,7 @@ MediaSourceDemuxer::AttemptInit()
return p;
}
void MediaSourceDemuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
void MediaSourceDemuxer::NotifyDataArrived()
{
nsRefPtr<MediaSourceDemuxer> self = this;
nsCOMPtr<nsIRunnable> task =

View File

@ -42,7 +42,7 @@ public:
bool ShouldComputeStartTime() const override { return false; }
void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
void NotifyDataArrived() override;
/* interface for TrackBuffersManager */
void AttachSourceBuffer(TrackBuffersManager* aSourceBuffer);

View File

@ -876,10 +876,8 @@ void
TrackBuffersManager::AppendDataToCurrentInputBuffer(MediaByteBuffer* aData)
{
MOZ_ASSERT(mCurrentInputBuffer);
int64_t offset = mCurrentInputBuffer->GetLength();
mCurrentInputBuffer->AppendData(aData);
// A MediaByteBuffer has a maximum size of 2GiB.
mInputDemuxer->NotifyDataArrived(uint32_t(aData->Length()), offset);
mInputDemuxer->NotifyDataArrived();
}
void

View File

@ -462,9 +462,9 @@ WebMDemuxer::EnsureUpToDateIndex()
}
void
WebMDemuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
WebMDemuxer::NotifyDataArrived()
{
WEBM_DEBUG("length: %ld offset: %ld", aLength, aOffset);
WEBM_DEBUG("");
mNeedReIndex = true;
}

View File

@ -129,7 +129,7 @@ private:
void Cleanup();
void InitBufferedState();
nsresult ReadMetadata();
void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
void NotifyDataArrived() override;
void NotifyDataRemoved() override;
void EnsureUpToDateIndex();
media::TimeIntervals GetBuffered();