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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* appropriate type, based on the compiled DSP support and
|
||||
|
@ -324,4 +336,3 @@ class AudioSource : public Source, public virtual Reporter
|
|||
|
||||
|
||||
#endif /* AUDIO_SOURCE_H */
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false;
|
||||
fileDateFormat = cs->get("fileDateFormat");
|
||||
|
||||
bufferSize = dsp->getBitsPerSample() / 8 * dsp->getSampleRate() * dsp->getChannel() * bufferSecs;
|
||||
bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs;
|
||||
reportEvent( 3, "buffer size: ", bufferSize);
|
||||
|
||||
localDumpName = cs->get( "localDumpFile");
|
||||
|
@ -410,7 +410,7 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
}
|
||||
#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());
|
||||
#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;
|
||||
fileDateFormat = cs->get( "fileDateFormat");
|
||||
|
||||
bufferSize = dsp->getBitsPerSample() / 8 * dsp->getSampleRate() * dsp->getChannel() * bufferSecs;
|
||||
bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs;
|
||||
reportEvent( 3, "buffer size: ", bufferSize);
|
||||
|
||||
localDumpName = cs->get( "localDumpFile");
|
||||
|
@ -616,7 +616,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
lowpass,
|
||||
highpass );
|
||||
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||
|
||||
#endif // HAVE_LAME_LIB
|
||||
break;
|
||||
|
@ -640,7 +640,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
dsp->getChannel(),
|
||||
maxBitrate);
|
||||
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||
#endif // HAVE_VORBIS_LIB
|
||||
break;
|
||||
|
||||
|
@ -681,7 +681,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
sampleRate,
|
||||
channel );
|
||||
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||
#endif // HAVE_TWOLAME_LIB
|
||||
break;
|
||||
|
||||
|
@ -702,7 +702,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
sampleRate,
|
||||
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
|
||||
break;
|
||||
|
||||
|
@ -722,7 +722,7 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
sampleRate,
|
||||
channel );
|
||||
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8);
|
||||
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
|
||||
#endif // HAVE_AACPLUS_LIB
|
||||
break;
|
||||
|
||||
|
@ -917,7 +917,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
channel,
|
||||
lowpass,
|
||||
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());
|
||||
#endif // HAVE_LAME_LIB
|
||||
|
@ -1273,10 +1273,7 @@ DarkIce :: encode ( void ) throw ( Exception )
|
|||
throw Exception( __FILE__, __LINE__, "can't open connector");
|
||||
}
|
||||
|
||||
bytes = dsp->getSampleRate() *
|
||||
(dsp->getBitsPerSample() / 8UL) *
|
||||
dsp->getChannel() *
|
||||
duration;
|
||||
bytes = dsp->getSampleRate() * dsp->getSampleSize() * duration;
|
||||
|
||||
len = encConnector->transfer( bytes, 4096, 1, 0 );
|
||||
|
||||
|
@ -1321,4 +1318,3 @@ DarkIce :: cut ( void ) throw ()
|
|||
|
||||
reportEvent( 5, "cutting ends");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue