changeset 24884:17c6e0a372f4

Simplify audio buffer allocation logic Remove code that set sh_audio->a_out_buffer to equal sh_audio->a_buffer between the calls to init_best_audio_codec and init_audio_filters. Nothing uses the buffer between those calls.
author uau
date Thu, 01 Nov 2007 06:51:44 +0000
parents 9d5f2d383382
children cd55d31cecb2
files libmpcodecs/dec_audio.c
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Thu Nov 01 06:51:38 2007 +0000
+++ b/libmpcodecs/dec_audio.c	Thu Nov 01 06:51:44 2007 +0000
@@ -120,9 +120,9 @@
 	   "ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n",
 	   sh_audio->i_bps * 8, sh_audio->samplerate, sh_audio->channels);
 
-    sh_audio->a_out_buffer_size = sh_audio->a_buffer_size;
-    sh_audio->a_out_buffer = sh_audio->a_buffer;
-    sh_audio->a_out_buffer_len = sh_audio->a_buffer_len;
+    sh_audio->a_out_buffer_size = 0;
+    sh_audio->a_out_buffer = NULL;
+    sh_audio->a_out_buffer_len = 0;
 
     return 1;
 }
@@ -299,8 +299,7 @@
 #endif
 	sh_audio->inited = 0;
     }
-    if (sh_audio->a_out_buffer != sh_audio->a_buffer)
-	free(sh_audio->a_out_buffer);
+    free(sh_audio->a_out_buffer);
     sh_audio->a_out_buffer = NULL;
     sh_audio->a_out_buffer_size = 0;
     if (sh_audio->a_buffer)
@@ -370,8 +369,7 @@
 	    out_maxsize = MAX_OUTBURST;	// not sure this is ok
 
 	sh_audio->a_out_buffer_size = out_maxsize;
-	if (sh_audio->a_out_buffer != sh_audio->a_buffer)
-	    free(sh_audio->a_out_buffer);
+	free(sh_audio->a_out_buffer);
 	sh_audio->a_out_buffer = memalign(16, sh_audio->a_out_buffer_size);
 	memset(sh_audio->a_out_buffer, 0, sh_audio->a_out_buffer_size);
 	sh_audio->a_out_buffer_len = 0;