summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2016-09-26 16:31:06 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2016-10-05 14:49:52 +0100
commita30c713e43823390889ea847531785a9253ecaaa (patch)
treeed399511743bf6e38102206e231061aab4b56075
parent1a4ba790446ef0e043bec9cd9d78aa296235d47b (diff)
oggmux: take audio clip meta into account for buffer duration
https://bugzilla.gnome.org/show_bug.cgi?id=768763
-rw-r--r--ext/ogg/gstoggmux.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c
index d2adb3b6c..9a8045447 100644
--- a/ext/ogg/gstoggmux.c
+++ b/ext/ogg/gstoggmux.c
@@ -807,6 +807,7 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
GstMapInfo map;
ogg_packet packet;
gboolean end_clip = TRUE;
+ GstAudioClippingMeta *meta;
/* ensure messing with metadata is ok */
buf = gst_buffer_make_writable (buf);
@@ -870,6 +871,21 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
end_time =
gst_ogg_stream_granule_to_time (&pad->map,
pad->next_granule + duration);
+ meta = gst_buffer_get_audio_clipping_meta (buf);
+ if (meta && meta->end) {
+ if (meta->format == GST_FORMAT_DEFAULT) {
+ if (meta->end > duration) {
+ GST_WARNING_OBJECT (pad->collect.pad,
+ "Clip meta tries to clip more sample than exist in the buffer, clipping all");
+ duration = 0;
+ } else {
+ duration -= meta->end;
+ }
+ } else {
+ GST_WARNING_OBJECT (pad->collect.pad,
+ "Unsupported format in clip meta");
+ }
+ }
if (end_time > pad->segment.stop
&& !GST_CLOCK_TIME_IS_VALID (gst_segment_to_running_time (&pad->segment,
GST_FORMAT_TIME, pad->segment.start + end_time))) {