mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
videotestsrc: do not set TIME duration when asked for another format
This fixes asserts in pipelines such as: gst-launch-1.0 videotestsrc num-buffers=1000 ! x264enc ! h264parse ! \ matroskamux name=mux ! filesink location=test.mkv
This commit is contained in:
parent
4ff4c1c10a
commit
1185fbd29a
1 changed files with 18 additions and 5 deletions
|
@ -783,11 +783,24 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
|||
}
|
||||
case GST_QUERY_DURATION:{
|
||||
if (bsrc->num_buffers != -1) {
|
||||
gint64 dur = gst_util_uint64_scale_int_round (bsrc->num_buffers
|
||||
* GST_SECOND, src->info.fps_d, src->info.fps_n);
|
||||
res = TRUE;
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, dur);
|
||||
break;
|
||||
GstFormat format;
|
||||
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
switch (format) {
|
||||
case GST_FORMAT_TIME:{
|
||||
gint64 dur = gst_util_uint64_scale_int_round (bsrc->num_buffers
|
||||
* GST_SECOND, src->info.fps_d, src->info.fps_n);
|
||||
res = TRUE;
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, dur);
|
||||
break;
|
||||
}
|
||||
case GST_FORMAT_BYTES:
|
||||
gst_query_set_duration (query, GST_FORMAT_BYTES,
|
||||
bsrc->num_buffers * src->info.size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue