inter: Increase the inter audio surface buffering

This commit is contained in:
David Schleef 2012-07-02 17:32:14 -07:00 committed by Sebastian Dröge
parent e5c55ad554
commit 963e6e3397
2 changed files with 8 additions and 7 deletions

View file

@ -332,10 +332,11 @@ gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
g_mutex_lock (interaudiosink->surface->mutex);
n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4;
if (n > (800 * 2 * 2)) {
GST_INFO ("flushing 800 samples");
gst_adapter_flush (interaudiosink->surface->audio_adapter, 800 * 4);
n -= 800;
#define SIZE 1600
if (n > (1600 * 3)) {
GST_WARNING ("flushing 800 samples");
gst_adapter_flush (interaudiosink->surface->audio_adapter, (SIZE / 2) * 4);
n -= (SIZE / 2);
}
gst_adapter_push (interaudiosink->surface->audio_adapter,
gst_buffer_ref (buffer));

View file

@ -393,8 +393,8 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
g_mutex_lock (interaudiosrc->surface->mutex);
n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4;
if (n > SIZE * 2) {
GST_DEBUG ("flushing %d samples", SIZE / 2);
if (n > SIZE * 3) {
GST_WARNING ("flushing %d samples", SIZE / 2);
gst_adapter_flush (interaudiosrc->surface->audio_adapter, (SIZE / 2) * 4);
n -= (SIZE / 2);
}
@ -409,7 +409,7 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
if (n < SIZE) {
GstBuffer *newbuf = gst_buffer_new_and_alloc (SIZE * 4);
GST_DEBUG ("creating %d samples of silence", SIZE - n);
GST_WARNING ("creating %d samples of silence", SIZE - n);
memset (GST_BUFFER_DATA (newbuf) + n * 4, 0, SIZE * 4 - n * 4);
if (buffer) {
memcpy (GST_BUFFER_DATA (newbuf), GST_BUFFER_DATA (buffer), n * 4);