Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
Index: apps/codecs/cook.c =================================================================== --- apps/codecs/cook.c +++ apps/codecs/cook.c @@ -86,59 +86,57 @@ ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE); /* The main decoder loop */ - while - { - /*if (ci->seek_time) { +seek_start : + while(packet_count) + { + bit_buffer = (uint8_t *) ci->request_buffer(&buff_size, scrambling_unit_size); + consumed = rm_get_packet(&bit_buffer, &rmctx, &pkt); + if(consumed < 0) { + DEBUGF("rm_get_packet failed\n"); + return CODEC_ERROR; + } + /*DEBUGF(" version = %d\n" + " length = %d\n" + " stream = %d\n" + " timestamp= %d\n",pkt.version,pkt.length,pkt.stream_number,pkt.timestamp);*/ - ci->set_elapsed(ci->seek_time); - n = ci->seek_time/10; - memset(buf,0,BUF_SIZE); - ci->seek_complete(); - }*/ - - while(packet_count) - { - bit_buffer = (uint8_t *) ci->request_buffer(&buff_size, scrambling_unit_size); - consumed = rm_get_packet(&bit_buffer, &rmctx, &pkt); - if(consumed < 0) { - DEBUGF("rm_get_packet failed\n"); - return CODEC_ERROR; - } - /*DEBUGF(" version = %d\n" - " length = %d\n" - " stream = %d\n" - " timestamp= %d\n",pkt.version,pkt.length,pkt.stream_number,pkt.timestamp);*/ + for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) + { + ci->yield(); + if + goto done; + if { + ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE); + ci->set_elapsed(0); + packet_count = rmctx.nb_packets; + rmctx.audio_pkt_cnt = 0; + rmctx.frame_number = 0; + ci->seek_complete(); + goto seek_start; + } - for(i = 0; i < rmctx.audio_pkt_cnt*(fs/sps) ; i++) - { - ci->yield(); - if - goto done; + res = cook_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); + rmctx.frame_number++; - res = cook_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); - rmctx.frame_number++; + /* skip the first two frames; no valid audio */ + if(rmctx.frame_number < 3) continue; - /* skip the first two frames; no valid audio */ - if(rmctx.frame_number < 3) continue; - - if(res != rmctx.block_align) { - DEBUGF("codec error\n"); - return CODEC_ERROR; - } - - ci->pcmbuf_insert(outbuf, NULL, rmctx.samples_pf_pc / rmctx.nb_channels); - ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); + if(res != rmctx.block_align) { + DEBUGF("codec error\n"); + return CODEC_ERROR; } - packet_count -= rmctx.audio_pkt_cnt; - rmctx.audio_pkt_cnt = 0; - ci->advance_buffer(consumed); + + ci->pcmbuf_insert(outbuf, NULL, rmctx.samples_pf_pc / rmctx.nb_channels); + ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); } - goto done; - + packet_count -= rmctx.audio_pkt_cnt; + rmctx.audio_pkt_cnt = 0; + ci->advance_buffer(consumed); } + done : if) goto next_track; return CODEC_OK; -} +}