Commit a30c713e authored by Vincent Penquerc'h's avatar Vincent Penquerc'h

oggmux: take audio clip meta into account for buffer duration

https://bugzilla.gnome.org/show_bug.cgi?id=768763
parent 1a4ba790
......@@ -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))) {
......
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