Bug 1157991 - Remove buggy/unused multiple-frame-per-packet handling from WebM decoders. r=giles

This commit is contained in:
Matthew Gregan 2015-06-04 00:19:17 +12:00
parent c575377dcc
commit 3a5a4891fb
3 changed files with 140 additions and 149 deletions

View File

@ -170,6 +170,11 @@ IntelWebMVideoDecoder::Demux(nsRefPtr<VP8Sample>& aSample, bool* aEOS)
return false;
}
if (count > 1) {
NS_WARNING("Packet contains more than one video frame");
return false;
}
int64_t tstamp = holder->Timestamp();
// The end time of this frame is the start time of the next frame. Fetch
@ -187,10 +192,9 @@ IntelWebMVideoDecoder::Demux(nsRefPtr<VP8Sample>& aSample, bool* aEOS)
}
mReader->SetLastVideoFrameTime(tstamp);
for (uint32_t i = 0; i < count; ++i) {
unsigned char* data;
size_t length;
r = nestegg_packet_data(packet, i, &data, &length);
r = nestegg_packet_data(packet, 0, &data, &length);
if (r == -1) {
return false;
}
@ -215,7 +219,6 @@ IntelWebMVideoDecoder::Demux(nsRefPtr<VP8Sample>& aSample, bool* aEOS)
if (!aSample->mData) {
return false;
}
}
return true;
}

View File

@ -98,6 +98,11 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
return false;
}
if (count > 1) {
NS_WARNING("Packet contains more than one video frame");
return false;
}
int64_t tstamp = holder->Timestamp();
// The end time of this frame is the start time of the next frame. Fetch
@ -115,10 +120,9 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
}
mReader->SetLastVideoFrameTime(tstamp);
for (uint32_t i = 0; i < count; ++i) {
unsigned char* data;
size_t length;
r = nestegg_packet_data(packet, i, &data, &length);
r = nestegg_packet_data(packet, 0, &data, &length);
if (r == -1) {
return false;
}
@ -133,9 +137,9 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
}
if (aKeyframeSkip && (!si.is_kf || tstamp < aTimeThreshold)) {
// Skipping to next keyframe...
a.mParsed++; // Assume 1 frame per chunk.
a.mParsed++;
a.mDropped++;
continue;
return true;
}
if (aKeyframeSkip && si.is_kf) {
@ -150,9 +154,9 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
// the time threshold required then it is not added
// to the video queue and won't be displayed.
if (tstamp < aTimeThreshold) {
a.mParsed++; // Assume 1 frame per chunk.
a.mParsed++;
a.mDropped++;
continue;
return true;
}
vpx_codec_iter_t iter = nullptr;
@ -215,7 +219,6 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
"Expect only 1 frame per chunk per packet in WebM...");
mReader->VideoQueue().Push(v);
}
}
return true;
}

View File

@ -919,27 +919,13 @@ WebMReader::DemuxPacket()
}
// Figure out if this is a keyframe.
//
// Doing this at packet-granularity is kind of the wrong level of
// abstraction, but timestamps are on the packet, so the only time
// we have multiple video frames in a packet is when we have "alternate
// reference frames", which are a compression detail and never displayed.
// So for our purposes, we can just take the union of the is_kf values for
// all the frames in the packet.
bool isKeyframe = false;
if (track == mAudioTrack) {
isKeyframe = true;
} else if (track == mVideoTrack) {
unsigned int count = 0;
r = nestegg_packet_count(packet, &count);
if (r == -1) {
return nullptr;
}
for (unsigned i = 0; i < count; ++i) {
unsigned char* data;
size_t length;
r = nestegg_packet_data(packet, i, &data, &length);
r = nestegg_packet_data(packet, 0, &data, &length);
if (r == -1) {
return nullptr;
}
@ -951,8 +937,7 @@ WebMReader::DemuxPacket()
} else if (mVideoCodec == NESTEGG_CODEC_VP9) {
vpx_codec_peek_stream_info(vpx_codec_vp9_dx(), data, length, &si);
}
isKeyframe = isKeyframe || si.is_kf;
}
isKeyframe = si.is_kf;
}
int64_t offset = mDecoder->GetResource()->Tell();