mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1111966 - Fix reporting of parsed and decoded frames for MP4Reader. r=cpearce
This commit is contained in:
parent
94612fe3a0
commit
c58ee588bc
@ -470,19 +470,16 @@ MP4Reader::RequestVideoData(bool aSkipToNextKeyframe,
|
||||
MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
|
||||
VLOG("RequestVideoData skip=%d time=%lld", aSkipToNextKeyframe, aTimeThreshold);
|
||||
|
||||
// Record number of frames decoded and parsed. Automatically update the
|
||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||
uint32_t parsed = 0, decoded = 0;
|
||||
AbstractMediaDecoder::AutoNotifyDecoded autoNotify(mDecoder, parsed, decoded);
|
||||
|
||||
MOZ_ASSERT(HasVideo() && mPlatform && mVideo.mDecoder);
|
||||
|
||||
bool eos = false;
|
||||
if (aSkipToNextKeyframe) {
|
||||
uint32_t parsed = 0;
|
||||
eos = !SkipVideoDemuxToNextKeyFrame(aTimeThreshold, parsed);
|
||||
if (!eos && NS_FAILED(mVideo.mDecoder->Flush())) {
|
||||
NS_WARNING("Failed to skip/flush video when skipping-to-next-keyframe.");
|
||||
}
|
||||
mDecoder->NotifyDecodedFrames(parsed, 0);
|
||||
}
|
||||
|
||||
MonitorAutoLock lock(mVideo.mMonitor);
|
||||
@ -493,12 +490,6 @@ MP4Reader::RequestVideoData(bool aSkipToNextKeyframe,
|
||||
ScheduleUpdate(kVideo);
|
||||
}
|
||||
|
||||
// Report the number of "decoded" frames as the difference in the
|
||||
// mNumSamplesOutput field since the last time we were called.
|
||||
uint64_t delta = mVideo.mNumSamplesOutput - mLastReportedNumDecodedFrames;
|
||||
decoded = static_cast<uint32_t>(delta);
|
||||
mLastReportedNumDecodedFrames = mVideo.mNumSamplesOutput;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -551,6 +542,11 @@ MP4Reader::Update(TrackType aTrack)
|
||||
{
|
||||
MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
|
||||
|
||||
// Record number of frames decoded and parsed. Automatically update the
|
||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||
uint32_t parsed = 0, decoded = 0;
|
||||
AbstractMediaDecoder::AutoNotifyDecoded autoNotify(mDecoder, parsed, decoded);
|
||||
|
||||
bool needInput = false;
|
||||
bool needOutput = false;
|
||||
auto& decoder = GetDecoderData(aTrack);
|
||||
@ -562,6 +558,11 @@ MP4Reader::Update(TrackType aTrack)
|
||||
decoder.mInputExhausted = false;
|
||||
decoder.mNumSamplesInput++;
|
||||
}
|
||||
if (aTrack == kVideo) {
|
||||
uint64_t delta = decoder.mNumSamplesOutput - mLastReportedNumDecodedFrames;
|
||||
decoded = static_cast<uint32_t>(delta);
|
||||
mLastReportedNumDecodedFrames = decoder.mNumSamplesOutput;
|
||||
}
|
||||
if (decoder.HasPromise()) {
|
||||
needOutput = true;
|
||||
if (!decoder.mOutput.IsEmpty()) {
|
||||
@ -585,6 +586,9 @@ MP4Reader::Update(TrackType aTrack)
|
||||
MP4Sample* sample = PopSample(aTrack);
|
||||
if (sample) {
|
||||
decoder.mDecoder->Input(sample);
|
||||
if (aTrack == kVideo) {
|
||||
parsed++;
|
||||
}
|
||||
} else {
|
||||
{
|
||||
MonitorAutoLock lock(decoder.mMonitor);
|
||||
|
Loading…
Reference in New Issue
Block a user