Bug 1371188 P3 - remove MediaDecoderReader::DecodeVideoFrame()'s aKeyframeSkip parameter;
Same as P2, we're going to remove synchronous decoding in
bug 1316211 and
bug 1316462.
Remove MediaDecoderReader::DecodeVideoFrame()'s aKeyframeSkip parameter now.
Actually, the only implementation of this method, AndroidMediaReader::DecodeVideoFrame()
doesn't use this parameter at all.
MozReview-Commit-ID: 4V6p1AjU7qM
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -160,18 +160,17 @@ MediaDecoderReader::DecodeToFirstVideoDa
{
MOZ_ASSERT(OnTaskQueue());
typedef VideoDataPromise PromiseType;
RefPtr<PromiseType::Private> p = new PromiseType::Private(__func__);
RefPtr<MediaDecoderReader> self = this;
InvokeUntil([self] () -> bool {
MOZ_ASSERT(self->OnTaskQueue());
NS_ENSURE_TRUE(!self->mShutdown, false);
- bool skip = false;
- if (!self->DecodeVideoFrame(skip, media::TimeUnit::Zero())) {
+ if (!self->DecodeVideoFrame(media::TimeUnit::Zero())) {
self->VideoQueue().Finish();
return !!self->VideoQueue().PeekFront();
}
return true;
}, [self] () -> bool {
MOZ_ASSERT(self->OnTaskQueue());
return self->VideoQueue().GetSize();
})->Then(OwnerThread(), __func__, [self, p] () {
@@ -263,20 +262,19 @@ private:
RefPtr<MediaDecoderReader> mReader;
};
RefPtr<MediaDecoderReader::VideoDataPromise>
MediaDecoderReader::RequestVideoData(bool aSkipToNextKeyframe,
const media::TimeUnit& aTimeThreshold)
{
RefPtr<VideoDataPromise> p = mBaseVideoPromise.Ensure(__func__);
- bool skip = aSkipToNextKeyframe;
while (VideoQueue().GetSize() == 0 &&
!VideoQueue().IsFinished()) {
- if (!DecodeVideoFrame(skip, aTimeThreshold)) {
+ if (!DecodeVideoFrame(aTimeThreshold)) {
VideoQueue().Finish();
}
}
if (VideoQueue().GetSize() > 0) {
RefPtr<VideoData> v = VideoQueue().PopFront();
mBaseVideoPromise.Resolve(v, __func__);
} else if (VideoQueue().IsFinished()) {
mBaseVideoPromise.Reject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -355,18 +355,17 @@ private:
return false;
}
// Overrides of this function should read and decodes one video frame.
// Packets with a timestamp less than aTimeThreshold will be decoded
// (unless they're not keyframes and aKeyframeSkip is true), but will
// not be added to the queue. This function blocks until the decode
// is complete.
- virtual bool DecodeVideoFrame(bool& aKeyframeSkip,
- const media::TimeUnit& aTimeThreshold)
+ virtual bool DecodeVideoFrame(const media::TimeUnit& aTimeThreshold)
{
return false;
}
// GetBuffered estimates the time ranges buffered by interpolating the cached
// byte ranges with the duration of the media. Reader subclasses should
// override this method if they can quickly calculate the buffered ranges more
// accurately.
--- a/dom/media/android/AndroidMediaReader.cpp
+++ b/dom/media/android/AndroidMediaReader.cpp
@@ -111,18 +111,17 @@ nsresult AndroidMediaReader::ResetDecode
if (mLastVideoFrame) {
mLastVideoFrame = nullptr;
}
mSeekRequest.DisconnectIfExists();
mSeekPromise.RejectIfExists(NS_OK, __func__);
return MediaDecoderReader::ResetDecode(aTracks);
}
-bool AndroidMediaReader::DecodeVideoFrame(bool& aKeyframeSkip,
- const media::TimeUnit& aTimeThreshold)
+bool AndroidMediaReader::DecodeVideoFrame(const media::TimeUnit& aTimeThreshold)
{
// Record number of frames decoded and parsed. Automatically update the
// stats counters using the AutoNotifyDecoded stack-based class.
AbstractMediaDecoder::AutoNotifyDecoded a(mDecoder);
// Throw away the currently buffered frame if we are seeking.
if (mLastVideoFrame && mVideoSeekTimeUs != -1) {
mLastVideoFrame = nullptr;
@@ -146,30 +145,16 @@ bool AndroidMediaReader::DecodeVideoFram
mLastVideoFrame->UpdateDuration(TimeUnit::FromMicroseconds(durationUs));
mVideoQueue.Push(mLastVideoFrame);
mLastVideoFrame = nullptr;
}
return false;
}
mVideoSeekTimeUs = -1;
- if (aKeyframeSkip) {
- // Disable keyframe skipping for now as
- // stagefright doesn't seem to be telling us
- // when a frame is a keyframe.
-#if 0
- if (!frame.mKeyFrame) {
- ++a.mStats.mParsedFrames;
- ++a.mStats.mDroppedFrames;
- continue;
- }
-#endif
- aKeyframeSkip = false;
- }
-
if (frame.mSize == 0)
return true;
currentImage = bufferCallback.GetImage();
int64_t pos = mDecoder->GetResource()->Tell();
IntRect picture = mPicture;
RefPtr<VideoData> v;
--- a/dom/media/android/AndroidMediaReader.h
+++ b/dom/media/android/AndroidMediaReader.h
@@ -39,18 +39,17 @@ class AndroidMediaReader : public MediaD
public:
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
const MediaContainerType& aContainerType);
nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
TrackInfo::kVideoTrack)) override;
bool DecodeAudioData() override;
- bool DecodeVideoFrame(bool& aKeyframeSkip,
- const media::TimeUnit& aTimeThreshold) override;
+ bool DecodeVideoFrame(const media::TimeUnit& aTimeThreshold) override;
nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) override;
RefPtr<SeekPromise> Seek(const SeekTarget& aTarget) override;
RefPtr<ShutdownPromise> Shutdown() override;
class ImageBufferCallback : public MPAPI::BufferCallback {
typedef mozilla::layers::Image Image;