Commit 96261ce2 authored by Olivier Crête's avatar Olivier Crête 👻

flvmux: Duration & unit tests

The muxed buffers will not carry the duration of the
incoming buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=793457
parent c0bf793c
...@@ -1174,9 +1174,11 @@ gst_flv_mux_buffer_to_tag_internal (GstFlvMux * mux, GstBuffer * buffer, ...@@ -1174,9 +1174,11 @@ gst_flv_mux_buffer_to_tag_internal (GstFlvMux * mux, GstBuffer * buffer,
GstClockTime timestamp = GST_CLOCK_TIME_NONE; GstClockTime timestamp = GST_CLOCK_TIME_NONE;
if (gst_segment_to_running_time_full (&GST_AGGREGATOR_PAD (pad)->segment, if (gst_segment_to_running_time_full (&GST_AGGREGATOR_PAD (pad)->segment,
GST_FORMAT_TIME, GST_BUFFER_DTS_OR_PTS (buffer), &timestamp) == 1) GST_FORMAT_TIME, GST_BUFFER_DTS_OR_PTS (buffer),
&timestamp) == 1) {
GST_BUFFER_PTS (tag) = timestamp; GST_BUFFER_PTS (tag) = timestamp;
GST_BUFFER_DURATION (tag) = GST_BUFFER_DURATION (buffer);
}
GST_BUFFER_OFFSET (tag) = GST_BUFFER_OFFSET_NONE; GST_BUFFER_OFFSET (tag) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (tag) = GST_BUFFER_OFFSET_NONE; GST_BUFFER_OFFSET_END (tag) = GST_BUFFER_OFFSET_NONE;
} else { } else {
......
...@@ -260,7 +260,8 @@ GST_START_TEST (test_speex_streamable) ...@@ -260,7 +260,8 @@ GST_START_TEST (test_speex_streamable)
/* pull header0 */ /* pull header0 */
buf = gst_harness_pull (h); buf = gst_harness_pull (h);
fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf)); fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf));
fail_unless_equals_uint64 (base_time, GST_BUFFER_DTS (buf)); fail_unless_equals_uint64 (GST_CLOCK_TIME_NONE, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (0, GST_BUFFER_DURATION (buf));
gst_buffer_map (buf, &map, GST_MAP_READ); gst_buffer_map (buf, &map, GST_MAP_READ);
/* 0x08 means it is audio */ /* 0x08 means it is audio */
fail_unless_equals_int (0x08, map.data[0]); fail_unless_equals_int (0x08, map.data[0]);
...@@ -276,7 +277,7 @@ GST_START_TEST (test_speex_streamable) ...@@ -276,7 +277,7 @@ GST_START_TEST (test_speex_streamable)
/* pull header1 */ /* pull header1 */
buf = gst_harness_pull (h); buf = gst_harness_pull (h);
fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf)); fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf));
fail_unless_equals_uint64 (base_time, GST_BUFFER_DTS (buf)); fail_unless_equals_uint64 (GST_CLOCK_TIME_NONE, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (0, GST_BUFFER_DURATION (buf)); fail_unless_equals_uint64 (0, GST_BUFFER_DURATION (buf));
gst_buffer_map (buf, &map, GST_MAP_READ); gst_buffer_map (buf, &map, GST_MAP_READ);
/* 0x08 means it is audio */ /* 0x08 means it is audio */
...@@ -293,7 +294,7 @@ GST_START_TEST (test_speex_streamable) ...@@ -293,7 +294,7 @@ GST_START_TEST (test_speex_streamable)
/* pull data */ /* pull data */
buf = gst_harness_pull (h); buf = gst_harness_pull (h);
fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf)); fail_unless_equals_uint64 (base_time, GST_BUFFER_PTS (buf));
fail_unless_equals_uint64 (base_time, GST_BUFFER_DTS (buf)); fail_unless_equals_uint64 (GST_CLOCK_TIME_NONE, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf)); fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf)); fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE,
...@@ -313,7 +314,7 @@ GST_START_TEST (test_speex_streamable) ...@@ -313,7 +314,7 @@ GST_START_TEST (test_speex_streamable)
/* pull data */ /* pull data */
buf = gst_harness_pull (h); buf = gst_harness_pull (h);
fail_unless_equals_uint64 (base_time + duration, GST_BUFFER_PTS (buf)); fail_unless_equals_uint64 (base_time + duration, GST_BUFFER_PTS (buf));
fail_unless_equals_uint64 (base_time + duration, GST_BUFFER_DTS (buf)); fail_unless_equals_uint64 (GST_CLOCK_TIME_NONE, GST_BUFFER_DTS (buf));
fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf)); fail_unless_equals_uint64 (duration, GST_BUFFER_DURATION (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf)); fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET (buf));
fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE, fail_unless_equals_uint64 (GST_BUFFER_OFFSET_NONE,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment