Bug 1171311: P4. Don't compute start time for MSE. r=cpearce

It is assumed per spec that it's 0.
Extra: remove redundant virtual keywords.

--HG--
extra : rebase_source : 40dc4876cd79f7b85e9f8b1afaa804ee6a417200
This commit is contained in:
Jean-Yves Avenard 2015-06-12 09:26:58 +10:00
parent b6bafeb601
commit 12944faa0d
4 changed files with 49 additions and 31 deletions

View File

@ -99,6 +99,11 @@ public:
// This will be called should the demuxer be used with MediaSource.
virtual void NotifyDataRemoved() { }
// Indicate to MediaFormatReader if it should compute the start time
// of the demuxed data. If true (default) the first sample returned will be
// used as reference time base.
virtual bool ShouldComputeStartTime() const { return true; }
protected:
virtual ~MediaDataDemuxer()
{

View File

@ -1469,4 +1469,13 @@ MediaFormatReader::NotifyDataRemoved()
TaskQueue()->Dispatch(task.forget());
}
int64_t
MediaFormatReader::ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio)
{
if (mDemuxer->ShouldComputeStartTime()) {
return MediaDecoderReader::ComputeStartTime(aVideo, aAudio);
}
return 0;
}
} // namespace mozilla

View File

@ -35,15 +35,15 @@ public:
virtual ~MediaFormatReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual size_t SizeOfVideoQueueInFrames() override;
virtual size_t SizeOfAudioQueueInFrames() override;
size_t SizeOfVideoQueueInFrames() override;
size_t SizeOfAudioQueueInFrames() override;
virtual nsRefPtr<VideoDataPromise>
nsRefPtr<VideoDataPromise>
RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThreshold) override;
virtual nsRefPtr<AudioDataPromise> RequestAudioData() override;
nsRefPtr<AudioDataPromise> RequestAudioData() override;
bool HasVideo() override
{
@ -55,47 +55,49 @@ public:
return mInfo.HasAudio();
}
virtual nsRefPtr<MetadataPromise> AsyncReadMetadata() override;
nsRefPtr<MetadataPromise> AsyncReadMetadata() override;
virtual void ReadUpdatedMetadata(MediaInfo* aInfo) override;
void ReadUpdatedMetadata(MediaInfo* aInfo) override;
virtual nsRefPtr<SeekPromise>
nsRefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aUnused) override;
virtual bool IsMediaSeekable() override
bool IsMediaSeekable() override
{
return mSeekable;
}
virtual int64_t GetEvictionOffset(double aTime) override;
virtual void NotifyDataArrived(const char* aBuffer,
int64_t GetEvictionOffset(double aTime) override;
void NotifyDataArrived(const char* aBuffer,
uint32_t aLength,
int64_t aOffset) override;
virtual void NotifyDataRemoved() override;
void NotifyDataRemoved() override;
virtual media::TimeIntervals GetBuffered() override;
media::TimeIntervals GetBuffered() override;
// For Media Resource Management
virtual void SetIdle() override;
virtual bool IsDormantNeeded() override;
virtual void ReleaseMediaResources() override;
virtual void SetSharedDecoderManager(SharedDecoderManager* aManager)
void SetIdle() override;
bool IsDormantNeeded() override;
void ReleaseMediaResources() override;
void SetSharedDecoderManager(SharedDecoderManager* aManager)
override;
virtual nsresult ResetDecode() override;
nsresult ResetDecode() override;
virtual nsRefPtr<ShutdownPromise> Shutdown() override;
nsRefPtr<ShutdownPromise> Shutdown() override;
virtual bool IsAsync() const override { return true; }
bool IsAsync() const override { return true; }
virtual bool VideoIsHardwareAccelerated() const override;
bool VideoIsHardwareAccelerated() const override;
virtual void DisableHardwareAcceleration() override;
void DisableHardwareAcceleration() override;
virtual bool IsWaitForDataSupported() override { return true; }
virtual nsRefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType) override;
bool IsWaitForDataSupported() override { return true; }
nsRefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType) override;
virtual bool IsWaitingOnCDMResource() override;
bool IsWaitingOnCDMResource() override;
int64_t ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio) override;
private:
bool InitDemuxer();
@ -154,22 +156,22 @@ private:
, mType(aType)
{
}
virtual void Output(MediaData* aSample) override {
void Output(MediaData* aSample) override {
mReader->Output(mType, aSample);
}
virtual void InputExhausted() override {
void InputExhausted() override {
mReader->InputExhausted(mType);
}
virtual void Error() override {
void Error() override {
mReader->Error(mType);
}
virtual void DrainComplete() override {
void DrainComplete() override {
mReader->DrainComplete(mType);
}
virtual void ReleaseMediaResources() override {
void ReleaseMediaResources() override {
mReader->ReleaseMediaResources();
}
virtual bool OnReaderTaskQueue() override {
bool OnReaderTaskQueue() override {
return mReader->OnTaskQueue();
}

View File

@ -47,6 +47,8 @@ public:
UniquePtr<EncryptionInfo> GetCrypto() override;
bool ShouldComputeStartTime() const override { return false; }
/* interface for TrackBuffersManager */
void AttachSourceBuffer(TrackBuffersManager* aSourceBuffer);
void DetachSourceBuffer(TrackBuffersManager* aSourceBuffer);