Bug 1217714 - Remove some unused functions from MediaDecoderReader. r=jya.

This commit is contained in:
JW Wang 2015-10-26 14:10:29 +08:00
parent c0d391dd98
commit fb4f215e74
16 changed files with 34 additions and 149 deletions

View File

@ -165,9 +165,6 @@ public:
// upon calls to Request{Audio,Video}Data.
virtual void SetDemuxOnly(bool /*aDemuxedOnly*/) {}
virtual bool HasAudio() = 0;
virtual bool HasVideo() = 0;
// The default implementation of AsyncReadMetadata is implemented in terms of
// synchronous ReadMetadata() calls. Implementations may also
// override AsyncReadMetadata to create a more proper async implementation.
@ -255,21 +252,9 @@ public:
UpdateBuffered();
}
// Notify the reader that data from the resource was evicted
// (MediaSource only).
virtual void NotifyDataRemoved() {}
virtual MediaQueue<AudioData>& AudioQueue() { return mAudioQueue; }
virtual MediaQueue<VideoData>& VideoQueue() { return mVideoQueue; }
// Returns a pointer to the decoder.
AbstractMediaDecoder* GetDecoder()
{
return mDecoder;
}
MediaInfo GetMediaInfo() { return mInfo; }
AbstractCanonical<media::TimeIntervals>* CanonicalBuffered()
{
return &mBuffered;

View File

@ -1544,11 +1544,8 @@ MediaFormatReader::NotifyDemuxer(uint32_t aLength, int64_t aOffset)
return;
}
if (aLength || aOffset) {
mDemuxer->NotifyDataArrived();
} else {
mDemuxer->NotifyDataRemoved();
}
mDemuxer->NotifyDataArrived();
if (!mInitDone) {
return;
}
@ -1571,14 +1568,6 @@ MediaFormatReader::NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset)
NotifyDemuxer(aLength, aOffset);
}
void
MediaFormatReader::NotifyDataRemoved()
{
MOZ_ASSERT(OnTaskQueue());
NotifyDemuxer(0, 0);
}
bool
MediaFormatReader::ForceZeroStartTime() const
{

View File

@ -42,16 +42,6 @@ public:
RefPtr<AudioDataPromise> RequestAudioData() override;
bool HasVideo() override
{
return mVideo.mTrackDemuxer;
}
bool HasAudio() override
{
return mAudio.mTrackDemuxer;
}
RefPtr<MetadataPromise> AsyncReadMetadata() override;
void ReadUpdatedMetadata(MediaInfo* aInfo) override;
@ -66,9 +56,8 @@ public:
protected:
void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) override;
public:
void NotifyDataRemoved() override;
public:
media::TimeIntervals GetBuffered() override;
virtual bool ForceZeroStartTime() const override;
@ -113,6 +102,9 @@ public:
#endif
private:
bool HasVideo() { return mVideo.mTrackDemuxer; }
bool HasAudio() { return mAudio.mTrackDemuxer; }
bool IsWaitingOnCDMResource();
bool InitDemuxer();

View File

@ -48,16 +48,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold);
virtual bool HasAudio()
{
return mHasAudio;
}
virtual bool HasVideo()
{
return mHasVideo;
}
virtual bool IsMediaSeekable()
{
// not used

View File

@ -303,21 +303,6 @@ AppleMP3Reader::DecodeVideoFrame(bool &aKeyframeSkip,
return false;
}
bool
AppleMP3Reader::HasAudio()
{
MOZ_ASSERT(OnTaskQueue());
return mStreamReady;
}
bool
AppleMP3Reader::HasVideo()
{
MOZ_ASSERT(OnTaskQueue());
return false;
}
bool
AppleMP3Reader::IsMediaSeekable()
{

View File

@ -28,9 +28,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual bool HasAudio() override;
virtual bool HasVideo() override;
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;

View File

@ -341,20 +341,6 @@ DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip,
return false;
}
bool
DirectShowReader::HasAudio()
{
MOZ_ASSERT(OnTaskQueue());
return true;
}
bool
DirectShowReader::HasVideo()
{
MOZ_ASSERT(OnTaskQueue());
return false;
}
RefPtr<MediaDecoderReader::SeekPromise>
DirectShowReader::Seek(int64_t aTargetUs, int64_t aEndTime)
{

View File

@ -47,9 +47,6 @@ public:
bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
bool HasAudio() override;
bool HasVideo() override;
nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;

View File

@ -56,21 +56,13 @@ protected:
virtual void NotifyDataArrivedInternal(uint32_t aLength,
int64_t aOffset) override;
public:
virtual bool HasAudio() override {
return mInfo.HasAudio();
}
virtual bool HasVideo() override {
return mInfo.HasVideo();
}
layers::ImageContainer* GetImageContainer() { return mDecoder->GetImageContainer(); }
virtual bool IsMediaSeekable() override;
private:
bool HasAudio() { return mInfo.HasAudio(); }
bool HasVideo() { return mInfo.HasVideo(); }
void ReadAndPushData(guint aLength);
RefPtr<layers::PlanarYCbCrImage> GetImageFromBuffer(GstBuffer* aBuffer);
void CopyIntoImageBuffer(GstBuffer *aBuffer, GstBuffer** aOutBuffer, RefPtr<layers::PlanarYCbCrImage> &image);

View File

@ -60,15 +60,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual bool HasAudio() override {
return (mVorbisState != 0 && mVorbisState->mActive) ||
(mOpusState != 0 && mOpusState->mActive);
}
virtual bool HasVideo() override {
return mTheoraState != 0 && mTheoraState->mActive;
}
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;
virtual RefPtr<SeekPromise>
@ -78,6 +69,15 @@ public:
virtual bool IsMediaSeekable() override;
private:
bool HasAudio() {
return (mVorbisState != 0 && mVorbisState->mActive) ||
(mOpusState != 0 && mOpusState->mActive);
}
bool HasVideo() {
return mTheoraState != 0 && mTheoraState->mActive;
}
// TODO: DEPRECATED. This uses synchronous decoding.
// Stores the presentation time of the first frame we'd be able to play if
// we started playback at the current position. Returns the first video

View File

@ -86,9 +86,6 @@ public:
// Disptach a DecodeAduioDataTask to decode video data.
virtual RefPtr<AudioDataPromise> RequestAudioData() override;
virtual bool HasAudio();
virtual bool HasVideo();
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata() override;
// Moves the decode head to aTime microseconds. aStartTime and aEndTime
@ -181,6 +178,8 @@ protected:
MozPromiseHolder<MediaResourcePromise> mMediaResourcePromise;
private:
virtual bool HasAudio() override;
virtual bool HasVideo() override;
// An intermediary class that can be managed by android::sp<T>.
// Redirect codecReserved() and codecCanceled() to MediaCodecReader.

View File

@ -49,6 +49,10 @@ protected:
android::MediaStreamSource* mStreamSource;
// Get value from the preferece, if true, we stop the audio offload.
bool IsMonoAudioEnabled();
private:
virtual bool HasAudio() = 0;
virtual bool HasVideo() = 0;
};
} // namespace mozilla

View File

@ -85,16 +85,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold);
virtual bool HasAudio()
{
return mHasAudio;
}
virtual bool HasVideo()
{
return mHasVideo;
}
virtual void ReleaseMediaResources() override;
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata() override;
@ -118,6 +108,9 @@ private:
class ProcessCachedDataTask;
class NotifyDataArrivedRunnable;
virtual bool HasAudio() override { return mHasAudio; }
virtual bool HasVideo() override { return mHasVideo; }
bool IsShutdown() {
MutexAutoLock lock(mShutdownMutex);
return mIsShutdown;

View File

@ -26,16 +26,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual bool HasAudio() override
{
return false;
}
virtual bool HasVideo() override
{
return true;
}
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;
virtual RefPtr<SeekPromise>

View File

@ -26,16 +26,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual bool HasAudio() override
{
return true;
}
virtual bool HasVideo() override
{
return false;
}
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags) override;
virtual RefPtr<SeekPromise>

View File

@ -69,6 +69,14 @@ protected:
~WebMReader();
public:
// Returns a pointer to the decoder.
AbstractMediaDecoder* GetDecoder()
{
return mDecoder;
}
MediaInfo GetMediaInfo() { return mInfo; }
virtual RefPtr<ShutdownPromise> Shutdown() override;
virtual nsresult Init() override;
virtual nsresult ResetDecode() override;
@ -77,18 +85,6 @@ public:
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;
virtual bool HasAudio() override
{
MOZ_ASSERT(OnTaskQueue());
return mHasAudio;
}
virtual bool HasVideo() override
{
MOZ_ASSERT(OnTaskQueue());
return mHasVideo;
}
virtual RefPtr<MetadataPromise> AsyncReadMetadata() override;
virtual RefPtr<SeekPromise>