<div>Hi, Speex Fans,</div>
<div> </div>
<div>I collected the speex raw file from flash server and tried to decode it with samepldec.c ( I modified the code the file input) as below.</div>
<div>speex rate=8khz, one framesize=10 bytes in the client,</div>
<div> </div>
<div>When I ran the decoding program, it kept displaying the error below and the file genertaed is corrupt too.</div>
<div>Please help point out what is wrong. I also attach the raw speex file. Thanks,</div>
<div> </div>
<div> </div>
<div>===include Partial Code =============================================</div>
<div>speex_bits_init(&bits);<br> /*Create a new decoder state in narrowband mode*/<br> state = speex_decoder_init(&speex_nb_mode);<br> //state = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));</div>
<div> speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &frame_size); </div>
<div> /*Set the perceptual enhancement on*/<br> tmp=1;<br> speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp);</div>
<div> speex_bits_init(&bits);</div>
<div> </div>
<div>.......</div>
<div><br> while (1)<br> {<br> /*Read the size encoded by sampleenc, this part will likely be <br> different in your application*/<br> nbBytes = fread(cbits, sizeof(char), 10, fin);<br> if (feof(fin))<br>
break;</div>
<div> /*Read the "packet" encoded by sampleenc*/<br> if (nbBytes > 0) {<br> /*Copy the data into the bit-stream struct*/<br> speex_bits_read_from(&bits, cbits, nbBytes);</div>
<div> /*Decode the data*/<br> if (speex_decode(state, &bits, output) == 0) <br> {<br> /*Copy from float to short (16 bits) for output*/<br> for (i=0;i<frame_size;i++)<br> out[i]=output[i];</div>
<div> /*Write the decoded audio to file*/<br> fwrite(out, sizeof(short), frame_size, fout);<br> }<br> }<br></div>
<div>errors:</div>
<div> </div>
<div> warning: Invalid mode encountered: corrupted stream?<br>warning: Invalid wideband mode encountered. Corrupted stream?<br>warning: Invalid wideband mode encountered. Corrupted stream?<br>warning: Invalid mode encountered: corrupted stream?<br>
warning: Invalid mode encountered: corrupted stream?<br>warning: Invalid wideband mode encountered. Corrupted stream?<br>warning: Invalid wideband mode encountered: corrupted stream?<br> </div>