Skip to content

Commit 3377dda

Browse files
committed
Merge pull request opencv#19041 from alalek:issue_19025
2 parents 2c634ee + 962f5c9 commit 3377dda

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/videoio/src/cap_gstreamer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,8 @@ double GStreamerCapture::getProperty(int propId) const
10621062
switch(propId)
10631063
{
10641064
case CV_CAP_PROP_POS_MSEC:
1065+
CV_LOG_ONCE_WARNING(NULL, "OpenCV | GStreamer: CAP_PROP_POS_MSEC property result may be unrealiable: "
1066+
"https://github.com/opencv/opencv/issues/19025");
10651067
format = GST_FORMAT_TIME;
10661068
status = gst_element_query_position(sink.get(), CV_GST_FORMAT(format), &value);
10671069
if(!status) {

modules/videoio/test/test_video_io.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ class Videoio_Bunny : public Videoio_Test_Base, public testing::TestWithParam<Ba
237237
if (!isBackendAvailable(apiPref, cv::videoio_registry::getStreamBackends()))
238238
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
239239

240+
// GStreamer: https://github.com/opencv/opencv/issues/19025
241+
if (apiPref == CAP_GSTREAMER)
242+
throw SkipTestException(cv::String("Backend ") + cv::videoio_registry::getBackendName(apiPref) +
243+
cv::String(" does not return reliable values for CAP_PROP_POS_MSEC property"));
244+
240245
if (((apiPref == CAP_FFMPEG) && ((ext == "h264") || (ext == "h265"))))
241246
throw SkipTestException(cv::String("Backend ") + cv::videoio_registry::getBackendName(apiPref) +
242247
cv::String(" does not support CAP_PROP_POS_MSEC option"));
@@ -253,10 +258,12 @@ class Videoio_Bunny : public Videoio_Test_Base, public testing::TestWithParam<Ba
253258
double timestamp = 0;
254259
ASSERT_NO_THROW(cap >> img);
255260
EXPECT_NO_THROW(timestamp = cap.get(CAP_PROP_POS_MSEC));
261+
if (cvtest::debugLevel > 0)
262+
std::cout << "i = " << i << ": timestamp = " << timestamp << std::endl;
256263
const double frame_period = 1000.f/bunny_param.getFps();
257264
// NOTE: eps == frame_period, because videoCapture returns frame begining timestamp or frame end
258265
// timestamp depending on codec and back-end. So the first frame has timestamp 0 or frame_period.
259-
EXPECT_NEAR(timestamp, i*frame_period, frame_period);
266+
EXPECT_NEAR(timestamp, i*frame_period, frame_period) << "i=" << i;
260267
}
261268
}
262269
};

0 commit comments

Comments
 (0)