mirror of
https://github.com/opencv/opencv.git
synced 2025-08-01 18:37:04 +08:00
Merge pull request #24657 from asmorkalov:as/ffmpeg_timeout_warning
Added warning, if FFmpeg pipeline was interrupted by timeout
This commit is contained in:
commit
0bf519dd05
@ -428,11 +428,15 @@ inline const char* _opencv_avcodec_get_name(CV_CODEC_ID id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static int _opencv_ffmpeg_interrupt_callback(void *ptr)
|
||||||
inline int _opencv_ffmpeg_interrupt_callback(void *ptr)
|
|
||||||
{
|
{
|
||||||
AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr;
|
AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr;
|
||||||
CV_Assert(metadata);
|
|
||||||
|
if(!metadata)
|
||||||
|
{
|
||||||
|
CV_LOG_WARNING(NULL, "Stream timeout without metadata passed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (metadata->timeout_after_ms == 0)
|
if (metadata->timeout_after_ms == 0)
|
||||||
{
|
{
|
||||||
@ -442,9 +446,15 @@ inline int _opencv_ffmpeg_interrupt_callback(void *ptr)
|
|||||||
timespec now;
|
timespec now;
|
||||||
get_monotonic_time(&now);
|
get_monotonic_time(&now);
|
||||||
|
|
||||||
metadata->timeout = get_monotonic_time_diff_ms(metadata->value, now) > metadata->timeout_after_ms;
|
double timeout = get_monotonic_time_diff_ms(metadata->value, now);
|
||||||
|
metadata->timeout = timeout > metadata->timeout_after_ms;
|
||||||
|
if (metadata->timeout)
|
||||||
|
{
|
||||||
|
CV_LOG_WARNING(NULL, cv::format("Stream timeout triggered after %lf ms", timeout));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return metadata->timeout ? -1 : 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user