avimux: Audio buffers should be picked earlier

Adds a 0.5s advantage for audio buffers to being
picked earlier for muxing.
This commit is contained in:
Thiago Santos 2009-11-04 16:04:10 -03:00
parent 98279be735
commit 8dd78015f1

View file

@ -1979,7 +1979,7 @@ gst_avi_mux_do_one_buffer (GstAviMux * avimux)
GstAviPad *avipad, *best_pad; GstAviPad *avipad, *best_pad;
GSList *node; GSList *node;
GstBuffer *buffer; GstBuffer *buffer;
GstClockTime time, best_time; GstClockTime time, best_time, delay;
node = avimux->sinkpads; node = avimux->sinkpads;
best_pad = NULL; best_pad = NULL;
@ -1996,12 +1996,14 @@ gst_avi_mux_do_one_buffer (GstAviMux * avimux)
time = GST_BUFFER_TIMESTAMP (buffer); time = GST_BUFFER_TIMESTAMP (buffer);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
delay = avipad->is_video ? GST_SECOND / 2 : 0;
/* invalid timestamp buffers pass first, /* invalid timestamp buffers pass first,
* these are probably initialization buffers */ * these are probably initialization buffers */
if (best_pad == NULL || !GST_CLOCK_TIME_IS_VALID (time) if (best_pad == NULL || !GST_CLOCK_TIME_IS_VALID (time)
|| (GST_CLOCK_TIME_IS_VALID (best_time) && time < best_time)) { || (GST_CLOCK_TIME_IS_VALID (best_time) && time + delay < best_time)) {
best_pad = avipad; best_pad = avipad;
best_time = time; best_time = time + delay;
} }
} }