Fixes BufferSink sample size
This commit is contained in:
parent
3f511ecda0
commit
e941d69f14
|
@ -264,6 +264,18 @@ class AudioSource : public Source, public virtual Reporter
|
||||||
return bitsPerSample;
|
return bitsPerSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of bytes for a sample for each channel
|
||||||
|
* (returns 4 bytes for 16 bits par sample in stereo)
|
||||||
|
*
|
||||||
|
* @return the number of bits per sample.
|
||||||
|
*/
|
||||||
|
inline unsigned int
|
||||||
|
getSampleSize ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return bitsPerSample / 8 * channel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory method for creating an AudioSource object of the
|
* Factory method for creating an AudioSource object of the
|
||||||
* appropriate type, based on the compiled DSP support and
|
* appropriate type, based on the compiled DSP support and
|
||||||
|
@ -324,4 +336,3 @@ class AudioSource : public Source, public virtual Reporter
|
||||||
|
|
||||||
|
|
||||||
#endif /* AUDIO_SOURCE_H */
|
#endif /* AUDIO_SOURCE_H */
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
fileDateFormat = cs->get("fileDateFormat");
|
fileDateFormat = cs->get("fileDateFormat");
|
||||||
|
|
||||||
bufferSize = dsp->getBitsPerSample() / 8 * dsp->getSampleRate() * dsp->getChannel() * bufferSecs;
|
bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs;
|
||||||
reportEvent( 3, "buffer size: ", bufferSize);
|
reportEvent( 3, "buffer size: ", bufferSize);
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
@ -410,7 +410,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
encConnector->attach( audioOuts[u].encoder.get());
|
encConnector->attach( audioOuts[u].encoder.get());
|
||||||
#endif // HAVE_LAME_LIB || HAVE_TWOLAME_LIB
|
#endif // HAVE_LAME_LIB || HAVE_TWOLAME_LIB
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||||
fileDateFormat = cs->get( "fileDateFormat");
|
fileDateFormat = cs->get( "fileDateFormat");
|
||||||
|
|
||||||
bufferSize = dsp->getBitsPerSample() / 8 * dsp->getSampleRate() * dsp->getChannel() * bufferSecs;
|
bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs;
|
||||||
reportEvent( 3, "buffer size: ", bufferSize);
|
reportEvent( 3, "buffer size: ", bufferSize);
|
||||||
|
|
||||||
localDumpName = cs->get( "localDumpFile");
|
localDumpName = cs->get( "localDumpFile");
|
||||||
|
@ -616,7 +616,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
lowpass,
|
lowpass,
|
||||||
highpass );
|
highpass );
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
|
|
||||||
#endif // HAVE_LAME_LIB
|
#endif // HAVE_LAME_LIB
|
||||||
break;
|
break;
|
||||||
|
@ -640,7 +640,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
dsp->getChannel(),
|
dsp->getChannel(),
|
||||||
maxBitrate);
|
maxBitrate);
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
#endif // HAVE_VORBIS_LIB
|
#endif // HAVE_VORBIS_LIB
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
channel );
|
channel );
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
#endif // HAVE_TWOLAME_LIB
|
#endif // HAVE_TWOLAME_LIB
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
dsp->getChannel());
|
dsp->getChannel());
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
#endif // HAVE_FAAC_LIB
|
#endif // HAVE_FAAC_LIB
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
channel );
|
channel );
|
||||||
|
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
#endif // HAVE_AACPLUS_LIB
|
#endif // HAVE_AACPLUS_LIB
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
channel,
|
channel,
|
||||||
lowpass,
|
lowpass,
|
||||||
highpass );
|
highpass );
|
||||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||||
|
|
||||||
encConnector->attach( audioOuts[u].encoder.get());
|
encConnector->attach( audioOuts[u].encoder.get());
|
||||||
#endif // HAVE_LAME_LIB
|
#endif // HAVE_LAME_LIB
|
||||||
|
@ -1273,10 +1273,7 @@ DarkIce :: encode ( void ) throw ( Exception )
|
||||||
throw Exception( __FILE__, __LINE__, "can't open connector");
|
throw Exception( __FILE__, __LINE__, "can't open connector");
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = dsp->getSampleRate() *
|
bytes = dsp->getSampleRate() * dsp->getSampleSize() * duration;
|
||||||
(dsp->getBitsPerSample() / 8UL) *
|
|
||||||
dsp->getChannel() *
|
|
||||||
duration;
|
|
||||||
|
|
||||||
len = encConnector->transfer( bytes, 4096, 1, 0 );
|
len = encConnector->transfer( bytes, 4096, 1, 0 );
|
||||||
|
|
||||||
|
@ -1321,4 +1318,3 @@ DarkIce :: cut ( void ) throw ()
|
||||||
|
|
||||||
reportEvent( 5, "cutting ends");
|
reportEvent( 5, "cutting ends");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue