1
0
Fork 0
forked from len0rd/rockbox

Enhance seeking in a52_rm ; it was a bit choppy, and fix a bug (request_buffer was called after eos and gave a seg fault) by changing the the

condition for the decoding loop.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22162 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Mohamed Tarek 2009-08-04 18:36:44 +00:00
parent 2b3b36a480
commit ac2ce3a449

View file

@ -157,15 +157,16 @@ next_track:
ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE ); ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE );
/* The main decoding loop */ /* The main decoding loop */
while(pkt.timestamp < rmctx.duration) { while(rmctx.audio_pkt_cnt < rmctx.nb_packets) {
ci->yield(); ci->yield();
if (ci->stop_codec || ci->new_track) if (ci->stop_codec || ci->new_track)
break; break;
if (ci->seek_time) { if (ci->seek_time) {
packet_offset = ci->seek_time / (((rmctx.block_align + PACKET_HEADER_SIZE)*8*1000)/rmctx.bit_rate); packet_offset = ci->seek_time / ((rmctx.block_align*8*1000)/rmctx.bit_rate);
ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + packet_offset*(rmctx.block_align + PACKET_HEADER_SIZE)); ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + packet_offset*(rmctx.block_align + PACKET_HEADER_SIZE));
samplesdone = A52_SAMPLESPERFRAME * packet_offset; rmctx.audio_pkt_cnt = packet_offset;
samplesdone = (rmctx.sample_rate/1000 * ci->seek_time);
ci->seek_complete(); ci->seek_complete();
} }