spacing, improve debug. WHen looking for starting keyframe in packetqueue, use <= instead of <.

This commit is contained in:
Isaac Connor 2019-01-14 14:00:45 -05:00
parent f726666f54
commit 84c812725e
3 changed files with 15 additions and 10 deletions

View File

@ -153,9 +153,12 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi
&& &&
( av_packet->stream_index == mVideoStreamId ) ( av_packet->stream_index == mVideoStreamId )
&& &&
timercmp( &(zm_packet->timestamp), recording_started, < ) timercmp( &(zm_packet->timestamp), recording_started, <= )
) { ) {
Debug(3, "Found keyframe before start with stream index (%d) with keyframe (%d)", av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ) ); Debug(3, "Found keyframe before start with stream index %d at %d.%d",
av_packet->stream_index,
zm_packet->timestamp.tv_sec,
zm_packet->timestamp.tv_usec );
break; break;
} }
} }
@ -185,8 +188,10 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi
zm_packet = pktQueue.front(); zm_packet = pktQueue.front();
av_packet = &(zm_packet->packet); av_packet = &(zm_packet->packet);
if ( ( ! ( av_packet->flags & AV_PKT_FLAG_KEY ) ) || ( av_packet->stream_index != mVideoStreamId ) ) { if ( ( ! ( av_packet->flags & AV_PKT_FLAG_KEY ) ) || ( av_packet->stream_index != mVideoStreamId ) ) {
Error( "Done looking for keyframe. Deleted %d frames. Remaining frames in queue: %d stream of head packet is (%d), keyframe (%d), distance(%d), packets(%d)", deleted_frames, pktQueue.size(), av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), distance( it, pktQueue.rend() ), pktQueue.size() ); Error( "Done looking for keyframe. Deleted %d frames. Remaining frames in queue: %d stream of head packet is (%d), keyframe (%d), distance(%d), packets(%d)",
deleted_frames, pktQueue.size(), av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), distance( it, pktQueue.rend() ), pktQueue.size() );
} else { } else {
Debug(1, "Done looking for keyframe. Deleted %d frames. Remaining frames in queue: %d stream of head packet is (%d), keyframe (%d), distance(%d), packets(%d)", deleted_frames, pktQueue.size(), av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), distance( it, pktQueue.rend() ), pktQueue.size() ); Debug(1, "Done looking for keyframe. Deleted %d frames. Remaining frames in queue: %d stream of head packet is (%d), keyframe (%d), distance(%d), packets(%d)",
deleted_frames, pktQueue.size(), av_packet->stream_index, ( av_packet->flags & AV_PKT_FLAG_KEY ), distance( it, pktQueue.rend() ), pktQueue.size() );
} }
} }

View File

@ -70,7 +70,7 @@ void StreamBase::updateFrameRate(double fps) {
while ( effective_fps > maxfps ) { while ( effective_fps > maxfps ) {
effective_fps /= 2.0; effective_fps /= 2.0;
frame_mod *= 2; frame_mod *= 2;
Debug(3, "EffectiveFPS:%.2f, FrameMod:%d", effective_fps, frame_mod); Debug(3, "Changing fps to be < max %.2f EffectiveFPS:%.2f, FrameMod:%d", maxfps, effective_fps, frame_mod);
} }
} }