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:
Vincent Penquerc'h 2014-01-10 09:53:21 +00:00
parent 4ff4c1c10a
commit 1185fbd29a

View file

@ -783,12 +783,25 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
}
case GST_QUERY_DURATION:{
if (bsrc->num_buffers != -1) {
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 */
}
default: