[xiph-commits] r19017 - trunk/squishyball

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Nov 12 01:56:21 PST 2013


Author: xiphmont
Date: 2013-11-12 01:56:21 -0800 (Tue, 12 Nov 2013)
New Revision: 19017

Modified:
   trunk/squishyball/audio.c
   trunk/squishyball/configure.ac
   trunk/squishyball/loader.c
Log:
Correct preexisting crash bug in channel reconsciliation code
correct progress report countdowns in Vorbis and Opus loaders


Modified: trunk/squishyball/audio.c
===================================================================
--- trunk/squishyball/audio.c	2013-11-12 08:51:00 UTC (rev 19016)
+++ trunk/squishyball/audio.c	2013-11-12 09:56:21 UTC (rev 19017)
@@ -357,7 +357,8 @@
 
 static void tokenize_channels(char *matrix,int *out,int n){
   int i=0;
-  char *t=strtok(matrix,",");
+  char *copy = strdup(matrix);
+  char *t=strtok(copy,",");
   memset(out,0,sizeof(*out)*n);
 
   while(t){
@@ -370,6 +371,7 @@
     i++;
     t=strtok(NULL,",");
   }
+  free(copy);
 }
 
 /* pre-permute sample ordering so that playback incurs ~equal
@@ -389,7 +391,16 @@
   tokenize_channels(A->matrix,ai,A->ch);
   tokenize_channels(B->matrix,bi,A->ch);
 
+  for(i=0;i<A->ch;i++)
+    fprintf(stderr,"%d, ",ai[i]);
+  fprintf(stderr," -> ");
+  for(i=0;i<B->ch;i++)
+    fprintf(stderr,"%d, ",bi[i]);
+  fprintf(stderr,"\n");
+
   for(i=0;i<A->ch;i++){
+    for(k=0;k<bps;k++)
+      p[i*bps+k]=i*bps+k; /* failsafe */
     for(j=0;j<A->ch;j++){
       if(bi[i]==ai[j]){
         for(k=0;k<bps;k++)
@@ -400,7 +411,7 @@
   }
 
   d=B->data;
-  for(o=0;o<B->size;){
+  for(o=0;o<B->size;o+=bpf){
     for(i=0;i<bpf;i++)
       temp[p[i]]=d[i];
     memcpy(d,temp,bpf);
@@ -709,7 +720,7 @@
       return NULL;
     aname=ai->short_name;
     if(sb_verbose)
-      fprintf(stderr,"Opening [%s] %s for %d/%d and %d channel[s]...",aname,device,bits,rate,ch);
+      fprintf(stderr,"Opening [%s] %s for %d/%d and %d channel[s]...",aname,"default",bits,rate,ch);
     ret=ao_open_live(id, &sf, &aoe);
     if(sb_verbose){
       if(!ret){

Modified: trunk/squishyball/configure.ac
===================================================================
--- trunk/squishyball/configure.ac	2013-11-12 08:51:00 UTC (rev 19016)
+++ trunk/squishyball/configure.ac	2013-11-12 09:56:21 UTC (rev 19017)
@@ -4,7 +4,7 @@
 cflags_save="$CFLAGS"
 AC_PREREQ(2.57)
 AC_INIT(main.c)
-AM_INIT_AUTOMAKE(squishyball, 20131109, [vorbis-dev at xiph.org])
+AM_INIT_AUTOMAKE(squishyball, 20131112, [vorbis-dev at xiph.org])
 AC_CONFIG_FILES([Makefile])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
 

Modified: trunk/squishyball/loader.c
===================================================================
--- trunk/squishyball/loader.c	2013-11-12 08:51:00 UTC (rev 19016)
+++ trunk/squishyball/loader.c	2013-11-12 09:56:21 UTC (rev 19017)
@@ -1110,7 +1110,7 @@
         d[fill++]=pcmout[j][i];
 
     if (sb_verbose && (throttle&0x3f)==0)
-      fprintf(stderr,"\rLoading %s: %ld to go...       ",pcm->name,(long)(pcm->size-fill));
+      fprintf(stderr,"\rLoading %s: %ld to go...       ",pcm->name,(long)(pcm->size-fill*sizeof(float)));
     throttle++;
   }
   ov_clear(&vf);
@@ -1238,7 +1238,7 @@
         d[fill++]=*s++;
 
     if (sb_verbose && (throttle&0x3f)==0)
-      fprintf(stderr,"\rLoading %s: %ld to go...       ",pcm->name,(long)(pcm->size-fill));
+      fprintf(stderr,"\rLoading %s: %ld to go...       ",pcm->name,(long)(pcm->size-fill*sizeof(float)));
     throttle++;
   }
   op_free(of);
@@ -1302,7 +1302,7 @@
     if(pcm->matrix)free(pcm->matrix);
     if(pcm->mix)free(pcm->mix);
     if(pcm->data)free(pcm->data);
-    memset(pcm,0,sizeof(pcm));
+    memset(pcm,0,sizeof(*pcm));
     free(pcm);
   }
 }



More information about the commits mailing list