Bug 1075640: Don't return 0-length frames for decoding; add comments about loss handling r=ehugg

Fixes OpenH264 crashes, especially under extreme packet loss
This commit is contained in:
Randell Jesup 2014-10-15 17:33:53 -04:00
parent 830662648f
commit 2037a7867d
2 changed files with 8 additions and 0 deletions

View File

@ -590,6 +590,11 @@ VCMEncodedFrame* VCMJitterBuffer::ExtractAndSetDecode(uint32_t timestamp) {
if ((*frame).IsSessionComplete())
UpdateAveragePacketsPerFrame(frame->NumPackets());
if (frame->Length() == 0) {
// Normally only if MakeDecodable() on an incomplete frame threw it all away
ReleaseFrame(frame);
return NULL;
}
return frame;
}

View File

@ -548,6 +548,9 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
int returnLength = InsertBuffer(frame_buffer, packet_list_it);
UpdateCompleteSession();
// We call MakeDecodable() before decoding, which removes packets after a loss
// (and which means h.264 mode 1 frames with a loss in the first packet will be
// totally removed)
if (decode_error_mode == kWithErrors)
decodable_ = true;
else if (decode_error_mode == kSelectiveErrors)