diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index ef61afc09..390f347de 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -721,7 +721,7 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event //Video recording if ( keyframe && recording.tv_sec ) { - uint32_t last_event_id = monitor->GetLastEventId() ; + uint32_t last_event_id = monitor->GetLastEventId(); uint32_t video_writer_event_id = monitor->GetVideoWriterEventId(); if ( last_event_id != video_writer_event_id ) { diff --git a/src/zm_packetqueue.cpp b/src/zm_packetqueue.cpp index 850e482fb..44bc35c0b 100644 --- a/src/zm_packetqueue.cpp +++ b/src/zm_packetqueue.cpp @@ -144,7 +144,7 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi // Step 2 - pop packets until we get to the packet in step 2 std::list::reverse_iterator it; - Debug(3, "Looking for keyframe after start recording stream id (%d)", mVideoStreamId ); + Debug(3, "Looking for keyframe after start recording stream id (%d)", mVideoStreamId); for ( it = pktQueue.rbegin(); it != pktQueue.rend(); ++ it ) { ZMPacket *zm_packet = *it; AVPacket *av_packet = &(zm_packet->packet); @@ -153,9 +153,12 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi && ( 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; } } @@ -174,7 +177,7 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi unsigned int deleted_frames = 0; ZMPacket *packet = NULL; - while ( distance( it, pktQueue.rend() ) > 1 ) { + while ( distance(it, pktQueue.rend()) > 1 ) { //while ( pktQueue.rend() != it ) { packet = pktQueue.front(); pktQueue.pop_front(); @@ -185,8 +188,10 @@ void zm_packetqueue::clear_unwanted_packets( timeval *recording_started, int mVi zm_packet = pktQueue.front(); av_packet = &(zm_packet->packet); 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 { - 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() ); } } diff --git a/src/zm_stream.cpp b/src/zm_stream.cpp index 8602fa88a..357d23ed7 100644 --- a/src/zm_stream.cpp +++ b/src/zm_stream.cpp @@ -54,7 +54,7 @@ bool StreamBase::loadMonitor(int monitor_id) { bool StreamBase::checkInitialised() { if ( !monitor ) { - Fatal( "Cannot stream, not initialised" ); + Fatal("Cannot stream, not initialised"); return false; } return true; @@ -67,10 +67,10 @@ void StreamBase::updateFrameRate(double fps) { Debug(3, "FPS:%.2f, MaxFPS:%.2f, BaseFPS:%.2f, EffectiveFPS:%.2f, FrameMod:%d, replay_rate(%d)", fps, maxfps, base_fps, effective_fps, frame_mod, replay_rate); // Min frame repeat? - while( effective_fps > maxfps ) { + while ( effective_fps > maxfps ) { effective_fps /= 2.0; 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); } }