Do not just reconnect to the input stream on EOF. pts/dts gets outof whack when doing passthrough. Instead treat it as a loss of signal, which will end the event and start a new one

This commit is contained in:
Isaac Connor 2018-03-01 19:21:41 -08:00
parent 1bc6e40fbc
commit 4d81b7b66b
1 changed files with 0 additions and 14 deletions

View File

@ -710,20 +710,6 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event
ret = av_read_frame( mFormatContext, &packet ); ret = av_read_frame( mFormatContext, &packet );
if ( ret < 0 ) { if ( ret < 0 ) {
av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE ); av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE );
if (
// Check if EOF.
(ret == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) ||
// Check for Connection failure.
(ret == -110)
) {
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 ); Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, ret, errbuf );
return -1; return -1;
} }