Changeset 884

Show
Ignore:
Timestamp:
10/02/06 22:28:30 (2 years ago)
Author:
alban
Message:

[Bug 88] fix the EncoderOggSource? read loop and create freecast-testencoder

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build-base.xml

    r842 r884  
    8989                        <fileset dir="source"> 
    9090                                <include name="**/test/resources/*" /> 
     91                                <include name="**/test/log4j.xml" /> 
    9192                        </fileset> 
    9293                </copy> 
     
    101102                <junit printsummary="yes" haltonfailure="${test.haltonfailure}" includeantruntime="yes" fork="yes"> 
    102103                        <formatter type="plain" /> 
     104                        <formatter type="xml" /> 
    103105                        <batchtest todir="${build.test.results.dir}"> 
    104106                                <fileset dir="source"> 
     
    150152                <binscript name="freecast-manager" mainclass="org.kolaka.freecast.manager.gui.Main"/> 
    151153                <binscript name="freecast-setup" mainclass="org.kolaka.freecast.setup.Main"/> 
     154                <binscript name="freecast-testencoder" mainclass="org.kolaka.freecast.ogg.tools.TestEncoder"/> 
    152155 
    153156                <copy todir="dist/bin" file="source/org/kolaka/freecast/classpath.bat" /> 
  • trunk/build.xml

    r882 r884  
    206206        </target> 
    207207 
    208         <target name="test" depends="build.test" description="Run the unit tests"> 
    209                 <property name="build.test.results.dir" value="build/test/results" /> 
    210                 <mkdir dir="${build.test.results.dir}" /> 
    211                 <property name="test.haltonfailure" value="true" /> 
    212                 <junit printsummary="yes" haltonfailure="${test.haltonfailure}" includeantruntime="yes" fork="yes"> 
    213                         <formatter type="plain" /> 
    214                         <batchtest todir="${build.test.results.dir}"> 
    215                                 <fileset dir="source"> 
    216                                         <include name="**/test/*Test.java" /> 
    217                                         <include name="**/test/*TestSuite.java" /> 
    218                                         <exclude name="**/test/*BaseTest.java" /> 
    219                                 </fileset> 
    220                         </batchtest> 
    221                         <classpath> 
    222                                 <pathelement path="build/core/classes" /> 
    223                                 <pathelement path="build/test/classes" /> 
    224                                 <path refid="path.test" /> 
    225                         </classpath> 
    226                         <sysproperty key="java.library.path" path="${track.tritonus.dir}" /> 
    227                 </junit> 
    228         </target> 
    229  
    230208        <target name="dist.jws.check"> 
    231209                <available file="${dist.jws.keystore}" property="dist.jws.possible" /> 
  • trunk/source/org/kolaka/freecast/config/DefaultConfigurationLoader.java

    r511 r884  
    3535import org.apache.commons.configuration.ConfigurationFactory; 
    3636import org.apache.commons.configuration.MapConfiguration; 
     37import org.apache.commons.configuration.PropertiesConfiguration; 
    3738import org.apache.commons.configuration.XMLConfiguration; 
    3839import org.apache.commons.logging.LogFactory; 
     
    107108                return configuration; 
    108109        } 
     110   
     111  private static final Configuration EMPTY_CONFIGURATION = new PropertiesConfiguration(); 
    109112 
    110113        protected Configuration loadDefaultConfiguration(String name) 
     
    112115                URL url = getClass().getResource("resources/config-" + name + ".xml"); 
    113116                if (url == null) { 
    114                         throw new ConfigurationException( 
    115                                        "Can't find the default configuration settings:" + name)
     117      LogFactory.getLog(getClass()).warn("Can't find the default configuration settings:" + name); 
     118      return EMPTY_CONFIGURATION
    116119                } 
    117120                LogFactory.getLog(getClass()).debug( 
  • trunk/source/org/kolaka/freecast/freecast-template.sh

    r447 r884  
    7878fi 
    7979 
    80 exec $JAVA_CMD -cp $classpath -Djava.library.path=$libdir/linux/x86 -Dapp.name=$appname -Dlog.dir=$logdir -Dlib.dir=$libdir @app.mainclass@ $* 
     80exec $JAVA_CMD $JAVA_OPTS -cp $classpath -Djava.library.path=$libdir/linux/x86 -Dapp.name=$appname -Dlog.dir=$logdir -Dlib.dir=$libdir @app.mainclass@ $* 
  • trunk/source/org/kolaka/freecast/ogg/DefaultOggPage.java

    r725 r884  
    148148                builder.append("absoluteGranulePosition", absoluteGranulePosition); 
    149149                builder.append("length", getLength()); 
    150     builder.append("payload length", payload.length); 
     150    builder.append("payload length", payload != null ? payload.length : -1); 
    151151                return builder.toString(); 
    152152        } 
  • trunk/source/org/kolaka/freecast/ogg/EncoderOggSource.java

    r517 r884  
    244244                while (!cacheFilled) { 
    245245                        int read = audioInput.read(readBuffer); 
    246  
    247                         if (read == 0 || read == -1) { 
     246       
     247      if (read == 0) { 
     248        continue; 
     249      } 
     250 
     251      if (read == -1) { 
    248252                                dspState.write(null, 0); 
    249253                                LogFactory.getLog(getClass()).debug("end of the read stream"); 
  • trunk/source/org/kolaka/freecast/ogg/test/OggStreamSourceTest.java

    r690 r884  
    4141        public void testReadFile() throws IOException { 
    4242    InputStream resource = OggTestResources.getResourceAsStream("sample.ogg"); 
    43  
     43     
    4444                OggStreamSource oggSource = new OggStreamSource(resource); 
    4545 
     
    4747                assertTrue("page must be first", firstPage.isFirstPage()); 
    4848 
     49    int pageCount = 0; 
    4950                OggPage page = firstPage; 
    5051                while (!page.isLastPage()) { 
    5152                        page = oggSource.next(); 
    5253                        assertFalse("page can't be first", page.isFirstPage()); 
     54      pageCount++; 
    5355                } 
    5456 
    5557                oggSource.close(); 
     58    assertEquals(14, pageCount); 
    5659        } 
    5760