Commit 1d1c153d authored by schreibfaul1's avatar schreibfaul1

celt switch mono -> stereo

mono stations are working now
https://icecast.walmradio.com:8443/otr_opus
parent cbc9e1b9
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* based on Xiph.Org Foundation celt decoder * based on Xiph.Org Foundation celt decoder
* *
* Created on: 26.01.2023 * Created on: 26.01.2023
* Updated on: 03.04.2024 * Updated on: 20.05.2024
*/ */
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// O G G / O P U S I M P L. // O G G / O P U S I M P L.
...@@ -61,17 +61,12 @@ float s_opusCompressionRatio = 0; ...@@ -61,17 +61,12 @@ float s_opusCompressionRatio = 0;
std::vector <uint32_t>s_opusBlockPicItem; std::vector <uint32_t>s_opusBlockPicItem;
bool OPUSDecoder_AllocateBuffers(){ bool OPUSDecoder_AllocateBuffers(){
const uint32_t CELT_SET_END_BAND_REQUEST = 10012;
const uint32_t CELT_SET_SIGNALLING_REQUEST = 10016;
s_opusChbuf = (char*)malloc(512); s_opusChbuf = (char*)malloc(512);
if(!CELTDecoder_AllocateBuffers()) {log_e("CELT not init"); return false;} if(!CELTDecoder_AllocateBuffers()) {log_e("CELT not init"); return false;}
s_opusSegmentTable = (uint16_t*)malloc(256 * sizeof(uint16_t)); s_opusSegmentTable = (uint16_t*)malloc(256 * sizeof(uint16_t));
if(!s_opusSegmentTable) {log_e("CELT not init"); return false;} if(!s_opusSegmentTable) {log_e("CELT not init"); return false;}
CELTDecoder_ClearBuffer();
OPUSDecoder_ClearBuffers(); OPUSDecoder_ClearBuffers();
s_opusError = celt_decoder_init(2); if(s_opusError < 0) {log_e("CELT not init"); return false;} // allocate CELT buffers after OPUS head (nr of channels is needed)
s_opusError = celt_decoder_ctl(CELT_SET_SIGNALLING_REQUEST, 0); if(s_opusError < 0) {log_e("CELT not init"); return false;}
s_opusError = celt_decoder_ctl(CELT_SET_END_BAND_REQUEST, 21); if(s_opusError < 0) {log_e("CELT not init"); return false;}
OPUSsetDefaults(); OPUSsetDefaults();
int32_t ret = 0, silkDecSizeBytes = 0; int32_t ret = 0, silkDecSizeBytes = 0;
...@@ -805,6 +800,11 @@ int parseOpusHead(uint8_t *inbuf, int nBytes){ // reference https://wiki.xiph.o ...@@ -805,6 +800,11 @@ int parseOpusHead(uint8_t *inbuf, int nBytes){ // reference https://wiki.xiph.o
(void)outputGain; (void)outputGain;
CELTDecoder_ClearBuffer();
s_opusError = celt_decoder_init(s_opusChannels); if(s_opusError < 0) {log_e("CELT not init"); return false;}
s_opusError = celt_decoder_ctl(CELT_SET_SIGNALLING_REQUEST, 0); if(s_opusError < 0) {log_e("CELT not init"); return false;}
s_opusError = celt_decoder_ctl(CELT_SET_END_BAND_REQUEST, 21); if(s_opusError < 0) {log_e("CELT not init"); return false;}
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment