From 7de59df080375ee41e8e706e82c0e6e77bfb935a Mon Sep 17 00:00:00 2001 From: Sune1337 Date: Fri, 21 Mar 2014 19:42:03 +0100 Subject: [PATCH] removed use of av_err2str. someone could not compile when using that macro. --- src/zm_ffmpeg_camera.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index d9174e6bb..50b9b677a 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -126,16 +126,20 @@ int FfmpegCamera::Capture( Image &image ) int avResult = av_read_frame( mFormatContext, &packet ); if ( avResult < 0 ) { - if (avResult == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) + char errbuf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(avResult, errbuf, AV_ERROR_MAX_STRING_SIZE); + if ( + // Check if EOF. + (avResult == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) || + // Check for Connection failure. + (avResult == -110) + ) { - Info( "av_read_frame returned EOF. Reopening stream." ); + Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf); ReopenFfmpeg(); - } else if (avResult == -110) { - Info( "av_read_frame returned \"%s\". Reopening stream.", av_err2str(avResult)) ; - ReopenFfmpeg(); - } else { - Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, av_err2str(avResult) ); } + + Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf ); return( -1 ); } Debug( 5, "Got packet from stream %d", packet.stream_index );