Merge branch 'monitor_packetqueue' into packetqueue

This commit is contained in:
Isaac Connor 2016-08-31 16:59:43 -04:00
commit 17e7f0ecfb
1 changed files with 20 additions and 21 deletions

View File

@ -600,27 +600,27 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
this->getMonitor()->getOrientation() ); this->getMonitor()->getOrientation() );
} }
strcpy(oldDirectory, event_file); strcpy(oldDirectory, event_file);
} // end if ! wasRecording
// Need to write out all the frames from the last keyframe? // Need to write out all the frames from the last keyframe?
unsigned int packet_count = 0; unsigned int packet_count = 0;
while ( packetqueue.popPacket( &queued_packet ) ) { while ( packetqueue.popPacket( &queued_packet ) ) {
packet_count += 1; packet_count += 1;
//Write the packet to our video store //Write the packet to our video store
if ( queued_packet.stream_index == mVideoStreamId ) { if ( queued_packet.stream_index == mVideoStreamId ) {
ret = videoStore->writeVideoFramePacket(&queued_packet, mFormatContext->streams[mVideoStreamId]); ret = videoStore->writeVideoFramePacket(&queued_packet, mFormatContext->streams[mVideoStreamId]);
} else if ( queued_packet.stream_index == mAudioStreamId ) { } else if ( queued_packet.stream_index == mAudioStreamId ) {
//ret = videoStore->writeAudioFramePacket(&queued_packet, mFormatContext->streams[mAudioStreamId]); //ret = videoStore->writeAudioFramePacket(&queued_packet, mFormatContext->streams[mAudioStreamId]);
} else { } else {
Warning("Unknown stream id in queued packet (%d)", queued_packet.stream_index ); Warning("Unknown stream id in queued packet (%d)", queued_packet.stream_index );
ret = -1; ret = -1;
} }
if ( ret < 0 ) { if ( ret < 0 ) {
//Less than zero and we skipped a frame //Less than zero and we skipped a frame
//av_free_packet( &queued_packet ); //av_free_packet( &queued_packet );
} }
} // end while packets in the packetqueue } // end while packets in the packetqueue
Debug(2, "Wrote %d queued packets", packet_count ); Debug(2, "Wrote %d queued packets", packet_count );
} // end if ! wasRecording
} else { } else {
if ( videoStore ) { if ( videoStore ) {
Info("Deleting videoStore instance"); Info("Deleting videoStore instance");
@ -635,7 +635,6 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
packetqueue.queuePacket(&packet); packetqueue.queuePacket(&packet);
} // end if } // end if
if ( packet.stream_index == mVideoStreamId ) { if ( packet.stream_index == mVideoStreamId ) {
#if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0) #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0)
if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 ) if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 )