From: Alexander Alekhin Date: Mon, 7 Dec 2020 21:18:47 +0000 (+0000) Subject: videoio(test): skip GStreamer in 'frame_timestamp' tests X-Git-Tag: accepted/tizen/unified/20220125.121719~1^2~1^2~262^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=962f5c9b82a6ea1239eb417c67b39a0446128e80;p=platform%2Fupstream%2Fopencv.git videoio(test): skip GStreamer in 'frame_timestamp' tests - CAP_PROP_POS_MSEC is not reliable --- diff --git a/modules/videoio/src/cap_gstreamer.cpp b/modules/videoio/src/cap_gstreamer.cpp index 5821fb0..08c25ca 100644 --- a/modules/videoio/src/cap_gstreamer.cpp +++ b/modules/videoio/src/cap_gstreamer.cpp @@ -1062,6 +1062,8 @@ double GStreamerCapture::getProperty(int propId) const switch(propId) { case CV_CAP_PROP_POS_MSEC: + CV_LOG_ONCE_WARNING(NULL, "OpenCV | GStreamer: CAP_PROP_POS_MSEC property result may be unrealiable: " + "https://github.com/opencv/opencv/issues/19025"); format = GST_FORMAT_TIME; status = gst_element_query_position(sink.get(), CV_GST_FORMAT(format), &value); if(!status) { diff --git a/modules/videoio/test/test_video_io.cpp b/modules/videoio/test/test_video_io.cpp index 19fc32b..44947f0 100644 --- a/modules/videoio/test/test_video_io.cpp +++ b/modules/videoio/test/test_video_io.cpp @@ -237,6 +237,11 @@ public: if (!isBackendAvailable(apiPref, cv::videoio_registry::getStreamBackends())) throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref)); + // GStreamer: https://github.com/opencv/opencv/issues/19025 + if (apiPref == CAP_GSTREAMER) + throw SkipTestException(cv::String("Backend ") + cv::videoio_registry::getBackendName(apiPref) + + cv::String(" does not return reliable values for CAP_PROP_POS_MSEC property")); + if (((apiPref == CAP_FFMPEG) && ((ext == "h264") || (ext == "h265")))) throw SkipTestException(cv::String("Backend ") + cv::videoio_registry::getBackendName(apiPref) + cv::String(" does not support CAP_PROP_POS_MSEC option")); @@ -253,10 +258,12 @@ public: double timestamp = 0; ASSERT_NO_THROW(cap >> img); EXPECT_NO_THROW(timestamp = cap.get(CAP_PROP_POS_MSEC)); + if (cvtest::debugLevel > 0) + std::cout << "i = " << i << ": timestamp = " << timestamp << std::endl; const double frame_period = 1000.f/bunny_param.getFps(); // NOTE: eps == frame_period, because videoCapture returns frame begining timestamp or frame end // timestamp depending on codec and back-end. So the first frame has timestamp 0 or frame_period. - EXPECT_NEAR(timestamp, i*frame_period, frame_period); + EXPECT_NEAR(timestamp, i*frame_period, frame_period) << "i=" << i; } } };