Merge branch 'smarter_packetqueue' into storageareas

This commit is contained in:
Isaac Connor 2018-10-15 11:34:05 -04:00
commit 5fce783b65
3 changed files with 6 additions and 1 deletions

View File

@ -869,6 +869,10 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event
if ( packet.stream_index == mVideoStreamId ) { if ( packet.stream_index == mVideoStreamId ) {
if ( keyframe ) { if ( keyframe ) {
Debug(3, "Clearing queue"); Debug(3, "Clearing queue");
if ( packetqueue->packet_count(mVideoStreamId) >= monitor->GetImageBufferCount() ) {
Warning("ImageBufferCount is too small. Either increase it or decrease time between keyframes");
}
packetqueue->clearQueue(monitor->GetPreEventCount(), mVideoStreamId); packetqueue->clearQueue(monitor->GetPreEventCount(), mVideoStreamId);
packetqueue->queuePacket(&packet); packetqueue->queuePacket(&packet);
} else if ( packetqueue->size() ) { } else if ( packetqueue->size() ) {

View File

@ -456,6 +456,7 @@ public:
void SetVideoWriterEventId( unsigned long long p_event_id ) { video_store_data->current_event = p_event_id; } void SetVideoWriterEventId( unsigned long long p_event_id ) { video_store_data->current_event = p_event_id; }
unsigned int GetPreEventCount() const { return pre_event_count; }; unsigned int GetPreEventCount() const { return pre_event_count; };
int GetImageBufferCount() const { return image_buffer_count; };
State GetState() const; State GetState() const;
int GetImage( int index=-1, int scale=100 ); int GetImage( int index=-1, int scale=100 );
Snapshot *getSnapshot() const; Snapshot *getSnapshot() const;

View File

@ -25,7 +25,7 @@ zm_packetqueue::zm_packetqueue( int p_max_stream_id ) {
max_stream_id = p_max_stream_id; max_stream_id = p_max_stream_id;
packet_counts = new int[max_stream_id+1]; packet_counts = new int[max_stream_id+1];
for ( int i=0; i <= max_stream_id; ++i ) for ( int i=0; i <= max_stream_id; ++i )
packet_counts = 0; packet_counts[i] = 0;
} }
zm_packetqueue::~zm_packetqueue() { zm_packetqueue::~zm_packetqueue() {