diff options
author | Andreas Huber <andih@google.com> | 2010-05-11 10:11:55 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-05-11 10:11:55 -0700 |
commit | 96f52cde23982f668592418a9548045237d5e327 (patch) | |
tree | a5502e0e6b6ca85dab03308a117324261a9caa00 /media/libstagefright/codecs | |
parent | adbda96f6a05507788bb4163d7fbe8a95948f0a5 (diff) | |
download | frameworks_av-96f52cde23982f668592418a9548045237d5e327.zip frameworks_av-96f52cde23982f668592418a9548045237d5e327.tar.gz frameworks_av-96f52cde23982f668592418a9548045237d5e327.tar.bz2 |
Better seek handling and proper reset of the vorbis decoder after a discontinuity (seek)
Change-Id: I3c76d35da48e0964f7a0fa2816f8573b5e1a9436
related-to-bug: 2674036
QA-impact: low, only affects ogg-vorbis playback through http
Diffstat (limited to 'media/libstagefright/codecs')
-rw-r--r-- | media/libstagefright/codecs/vorbis/dec/VorbisDecoder.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/media/libstagefright/codecs/vorbis/dec/VorbisDecoder.cpp b/media/libstagefright/codecs/vorbis/dec/VorbisDecoder.cpp index 5485f25..df3f16a 100644 --- a/media/libstagefright/codecs/vorbis/dec/VorbisDecoder.cpp +++ b/media/libstagefright/codecs/vorbis/dec/VorbisDecoder.cpp @@ -173,18 +173,19 @@ int VorbisDecoder::decodePacket(MediaBuffer *packet, MediaBuffer *out) { pack.granulepos = 0; pack.packetno = 0; + int numFrames = 0; + int err = vorbis_dsp_synthesis(mState, &pack, 1); if (err != 0) { LOGW("vorbis_dsp_synthesis returned %d", err); - return 0; - } - - int numFrames = vorbis_dsp_pcmout( - mState, (int16_t *)out->data(), kMaxNumSamplesPerBuffer); + } else { + numFrames = vorbis_dsp_pcmout( + mState, (int16_t *)out->data(), kMaxNumSamplesPerBuffer); - if (numFrames < 0) { - LOGE("vorbis_dsp_pcmout returned %d", numFrames); - return 0; + if (numFrames < 0) { + LOGE("vorbis_dsp_pcmout returned %d", numFrames); + numFrames = 0; + } } out->set_range(0, numFrames * sizeof(int16_t) * mNumChannels); @@ -203,6 +204,7 @@ status_t VorbisDecoder::read( CHECK(seekTimeUs >= 0); mNumFramesOutput = 0; + vorbis_dsp_restart(mState); } else { seekTimeUs = -1; } |