[xiph-cvs] cvs commit: snatch snatchconvert.c
Monty
xiphmont at xiph.org
Tue Feb 18 15:28:30 PST 2003
xiphmont 03/02/18 18:28:30
Modified: . snatchconvert.c
Log:
Audio only conversion fix
Revision Changes Path
1.16 +36 -30 snatch/snatchconvert.c
Index: snatchconvert.c
===================================================================
RCS file: /usr/local/cvsroot/snatch/snatchconvert.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- snatchconvert.c 26 Feb 2002 18:50:29 -0000 1.15
+++ snatchconvert.c 18 Feb 2003 23:28:29 -0000 1.16
@@ -505,39 +505,45 @@
}else{
long long actualpos=(t-audbuf_zerotime)*audbuf_rate*audbuf_channels+.5;
long i;
-
- //fprintf(stderr,"audio sample jitter: %ld [%ld:%ld]\n",
- //(long)(nextsamplepos-actualpos),(long)nextsamplepos,(long)actualpos);
-
- /* hold last sample through any gap, assuming a bit of
- hysteresis. That also holds us through roundoff error (the
- roundoff error does *not* creep frame to frame) */
- if(audbuf_channels>1){
- for(i=actualpos-nextsamplepos-12;i>0;i-=2){
- rebuffer_sample(-2,track_or_process);
- rebuffer_sample(-2,track_or_process);
- samplesmissing++;
- //fprintf(stderr,".");
- }
- }else{
- for(i=actualpos-nextsamplepos-12;i>0;i--){
- rebuffer_sample(-1,track_or_process);
- samplesmissing++;
- //fprintf(stderr,".");
- }
- }
-
- /* discard samples if we're way too far ahead; only likely to
- happen due to a fault or misuse of splicing */
- if(nextsamplepos-actualpos>12){
- /* if we're so far ahead more than 10% of the frame must
- disappear, just discard, else compact things a bit by
- dropping samples */
- fprintf(stderr,"audio sync got way ahead; this case not currently handled\n");
- exit(1);
+ /* we do not nail conversion to a realtime clock when only audio
+ has been captured; Snatch may have faked the audio interface,
+ which decoupled playback from any clock */
+ if(video_p){
+
+ //fprintf(stderr,"audio sample jitter: %ld [%ld:%ld]\n",
+ //(long)(nextsamplepos-actualpos),(long)nextsamplepos,(long)actualpos);
+
+ /* hold last sample through any gap, assuming a bit of
+ hysteresis. That also holds us through roundoff error (the
+ roundoff error does *not* creep frame to frame) */
+ if(audbuf_channels>1){
+ for(i=actualpos-nextsamplepos-12;i>0;i-=2){
+ rebuffer_sample(-2,track_or_process);
+ rebuffer_sample(-2,track_or_process);
+ samplesmissing++;
+ //fprintf(stderr,".");
+ }
+ }else{
+ for(i=actualpos-nextsamplepos-12;i>0;i--){
+ rebuffer_sample(-1,track_or_process);
+ samplesmissing++;
+ //fprintf(stderr,".");
+ }
+ }
+ /* discard samples if we're way too far ahead; only likely to
+ happen due to a fault or misuse of splicing */
+ if(nextsamplepos-actualpos>12){
+ /* if we're so far ahead more than 10% of the frame must
+ disappear, just discard, else compact things a bit by
+ dropping samples */
+
+ fprintf(stderr,"audio sync got way ahead; this case not currently handled\n");
+ exit(1);
+
+ }
}
}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list