Count non-i frames in frames_to_keep. Should reduce the size of the packetqueue
parent
b25452d4c5
commit
727bde752f
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue