Count non-i frames in frames_to_keep. Should reduce the size of the packetqueue

pull/2077/head
Isaac Connor 2018-01-07 13:39:13 -05:00
parent b25452d4c5
commit 727bde752f
1 changed files with 15 additions and 1 deletions

View File

@ -77,10 +77,24 @@ unsigned int zm_packetqueue::clearQueue( unsigned int frames_to_keep, int stream
Debug(4, "Looking at packet with stream index (%d) with keyframe (%d), frames_to_keep is (%d)", av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), frames_to_keep ); Debug(4, "Looking at packet with stream index (%d) with keyframe (%d), frames_to_keep is (%d)", av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), frames_to_keep );
// Want frames_to_keep video keyframes. Otherwise, we may not have enough // Want frames_to_keep video keyframes. Otherwise, we may not have enough
if ( ( av_packet->stream_index == stream_id) && ( av_packet->flags & AV_PKT_FLAG_KEY ) ) { if ( ( av_packet->stream_index == stream_id) ) {
//&& ( av_packet->flags & AV_PKT_FLAG_KEY ) ) {
frames_to_keep --; frames_to_keep --;
} }
} }
// Make sure we start on a keyframe
for ( ; it != pktQueue.rend(); ++it ) {
ZMPacket *zm_packet = *it;
AVPacket *av_packet = &(zm_packet->packet);
Debug(4, "Looking for keyframe at packet with stream index (%d) with keyframe (%d), frames_to_keep is (%d)", av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), frames_to_keep );
// Want frames_to_keep video keyframes. Otherwise, we may not have enough
if ( ( av_packet->stream_index == stream_id) && ( av_packet->flags & AV_PKT_FLAG_KEY ) ) {
break;
}
}
if ( frames_to_keep ) { if ( frames_to_keep ) {
Debug(3, "Hit end of queue, still need (%d) video keyframes", frames_to_keep ); Debug(3, "Hit end of queue, still need (%d) video keyframes", frames_to_keep );
} }