From 9caa71233a5d9fec8576519cdc8f330c97c4aabb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 17 Feb 2018 11:07:06 -0500 Subject: [PATCH] catch another EOF case --- src/zm_ffmpeg_camera.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index b70ddcde9..576e83868 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -207,7 +207,7 @@ int FfmpegCamera::Capture( Image &image ) { } Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf ); - return( -1 ); + return -1; } int keyframe = packet.flags & AV_PKT_FLAG_KEY; @@ -710,12 +710,16 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event // Check for Connection failure. (ret == -110) ) { - Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf); - ReopenFfmpeg(); + Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf); + if ( ReopenFfmpeg() < 0 ) { + // OpenFfmpeg will do enough logging. + return -1; + } + continue; } Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, ret, errbuf ); - return( -1 ); + return -1; } int keyframe = packet.flags & AV_PKT_FLAG_KEY;