From f7d4658da084e58d1bb65b1fe7b3101dfa3d1927 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 19 Jan 2020 21:24:32 +0100 Subject: [PATCH] ffmpegdec: 2.try to fix ogg stream play Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7f4c1c2848482da8535fff7bd3f50cee71080c42 Author: Jacek Jendrzej Date: 2020-01-19 (Sun, 19 Jan 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audiodec/ffmpegdec.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index b33d8ce8a..c76159464 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -112,7 +112,10 @@ int64_t CFfmpegDec::Seek(int64_t offset, int whence) if (whence == AVSEEK_SIZE) return (int64_t) -1; - fseek((FILE *) in, (long) offset, whence); + int ret = fseek((FILE *) in, (long) offset, whence); + if(ret < 0) { + return -1; + } return (int64_t) ftell((FILE *) in); } @@ -151,15 +154,10 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType ft) av_freep(&buffer); return false; } - bool use_seek = true; - if (is_stream){ - avc->probesize = 128 * 1024; - av_opt_set_int(avc, "analyzeduration", 1000000, 0); - if(ft == CFile::FILE_OGG) - use_seek = false; - } + avc->probesize = 128 * 1024; + av_opt_set_int(avc, "analyzeduration", 1000000, 0); - avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, use_seek ? seek_packet:NULL); + avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, seek_packet); if (!avioc) { av_freep(&buffer); avformat_free_context(avc);