[xiph-commits] r7383 - in icecast/trunk/ices0: . src

brendan at dactyl.lonelymoon.com brendan
Tue Jul 27 16:07:06 PDT 2004


Author: brendan
Date: Tue Jul 27 16:07:06 2004
New Revision: 7383

Modified:
icecast/trunk/ices0/BUGS
icecast/trunk/ices0/src/crossfade.c
Log:
Don't crossfade when sample rate changes. Note the buffering will still
cause misencoding. I'm not sure how to fix this - either with some kind of
buffer flush hook (but it would have to be before the encoder restarted), or
by writing a resampler. Neither one is appetizing, maybe I'll just stick with
a WARNING: don't use crossfader if sample rate changes.


Modified: icecast/trunk/ices0/BUGS
===================================================================
--- icecast/trunk/ices0/BUGS	2004-07-27 22:29:19 UTC (rev 7382)
+++ icecast/trunk/ices0/BUGS	2004-07-27 23:07:05 UTC (rev 7383)
@@ -1,3 +1,4 @@
* Handles error conditions poorly.
+* Crossfader mishandles sample rate change. Maybe I need a resampler?

-$Id: BUGS,v 1.7 2003/06/20 03:28:25 brendan Exp $
\ No newline at end of file
+$Id$


Property changes on: icecast/trunk/ices0/BUGS
___________________________________________________________________
Name: svn:keywords
+ Id

Modified: icecast/trunk/ices0/src/crossfade.c
===================================================================
--- icecast/trunk/ices0/src/crossfade.c	2004-07-27 22:29:19 UTC (rev 7382)
+++ icecast/trunk/ices0/src/crossfade.c	2004-07-27 23:07:05 UTC (rev 7383)
@@ -1,6 +1,6 @@
/* crossfade.c
* Crossfader plugin
- * Copyright (c) 2004 Brendan Cully
+ * Copyright (c) 2004 Brendan Cully <brendan at xiph.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,14 +33,14 @@
NULL
};

-static int NewTrack = 0;
static int FadeSamples;
static int16_t* FL;
static int16_t* FR;
static int fpos = 0;
static int flen = 0;
-static int skipnext = 0;

+static int NewTrack = 0;
+
/* public functions */
ices_plugin_t *crossfade_plugin(int secs) {
FadeSamples = secs * 44100;
@@ -53,8 +53,15 @@

/* private functions */
static void cf_new_track(input_stream_t *source) {
+  static int skipnext = 0;
+  static input_stream_t lasttrack;
int filesecs;

+  if (lasttrack.samplerate && lasttrack.samplerate != source->samplerate)
+    skipnext = 1;
+
+  memcpy(&lasttrack, source, sizeof(lasttrack));
+
/* turn off crossfading for tracks less than twice the length of the fade */
if (skipnext) {
skipnext = 0;


Property changes on: icecast/trunk/ices0/src/crossfade.c
___________________________________________________________________
Name: svn:keywords
+ Id



More information about the commits mailing list