From cca92ad563a521bcabccd261de2ce2ce54eca8db Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 31 Aug 2013 18:51:51 -0700 Subject: [PATCH] Fix another crash when seeking audio --- src/core/audiosource.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/audiosource.cpp b/src/core/audiosource.cpp index ea237210b8..512b0a1eef 100644 --- a/src/core/audiosource.cpp +++ b/src/core/audiosource.cpp @@ -376,8 +376,6 @@ void FFMS_AudioSource::GetAudio(void *Buf, int64_t Start, int64_t Count) { } // Decode another block else { - CacheIterator cachePos = it; --cachePos; - if (Start < CurrentSample && SeekOffset == -1) throw FFMS_Exception(FFMS_ERROR_SEEKING, FFMS_ERROR_CODEC, "Audio stream is not seekable"); @@ -406,7 +404,8 @@ void FFMS_AudioSource::GetAudio(void *Buf, int64_t Start, int64_t Count) { if (CurrentSample > Start) throw FFMS_Exception(FFMS_ERROR_SEEKING, FFMS_ERROR_CODEC, "Seeking is severely broken"); - it = cachePos; + // The block we want is now in the cache immediate before it + --it; } } }