From f9c295808549a6aae36dbf0fa85f88cd74739e23 Mon Sep 17 00:00:00 2001 From: max_10 Date: Wed, 11 Apr 2018 23:02:02 +0200 Subject: [PATCH] bugfix-last-commits Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/d438aa31d385130cce5332c55986c587927786f7 Author: max_10 Date: 2018-04-11 (Wed, 11 Apr 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/playback_libeplayer3.cpp | 2 +- libeplayer3-arm/container/container_ffmpeg.c | 21 ++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libarmbox/playback_libeplayer3.cpp b/libarmbox/playback_libeplayer3.cpp index c5acdba..83a75ae 100644 --- a/libarmbox/playback_libeplayer3.cpp +++ b/libarmbox/playback_libeplayer3.cpp @@ -117,7 +117,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in } else isHTTP = true; - PlayFiles_t playbackFiles = { (char *) file.c_str(), NULL}; + PlayFiles_t playbackFiles = { (char *) file.c_str(), NULL, NULL, NULL, 0, 0, 0, 0}; if (player->playback->Command(player, PLAYBACK_OPEN, &playbackFiles) == 0) { if (pm == PLAYMODE_TS) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index a8b4f46..7cb9fab 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -1378,14 +1378,14 @@ int SAM_ReadFunc(void *ptr, uint8_t *buffer, int lSize) } else { - if (io->iOffset < io->iMoovAtomOffset) + if ((uint64_t)io->iOffset < io->iMoovAtomOffset) { ret = (int)fread((void *) buffer, (size_t) 1, (size_t) lSize, io->pFile); buffer += ret; lSize -= ret; } - if (io->iOffset + ret >= io->iMoovAtomOffset) + if ((uint64_t)io->iOffset + ret >= io->iMoovAtomOffset) { if (ret) { @@ -1440,12 +1440,12 @@ int64_t SAM_SeekFunc(void *ptr, int64_t pos, int whence) return -1; } - if (ret >= 0 && ret <= io->iFileSize) + if (ret >= 0 && (uint64_t)ret <= io->iFileSize) { - if (ret < io->iMoovAtomOffset) + if ((uint64_t)ret < io->iMoovAtomOffset) { if (!fseeko(io->pFile, (off_t)ret, SEEK_SET)) - io->iOffset = ret; + io->iOffset = (uint64_t)ret; else ret = -1; } @@ -1520,7 +1520,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin { AVIOContext *avio_ctx = NULL; custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t)); - sizeof(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t)); + memset(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t)); custom_io_tab[AVIdx]->szFile = filename; custom_io_tab[AVIdx]->iFileSize = fileSize; @@ -2690,7 +2690,12 @@ static int32_t container_ffmpeg_stop(Context_t *context) * avformat_close_input do not expect custom io, so it try * to release incorrectly */ - fclose(avContextTab[i]->pb->opaque); + CustomIOCtx_t *io = (CustomIOCtx_t *)avContextTab[i]->pb->opaque; + if (io->pFile) + fclose(io->pFile); + if (io->pMoovFile) + fclose(io->pMoovFile); + free(custom_io_tab[i]); av_freep(&(avContextTab[i]->pb->buffer)); av_freep(&(avContextTab[i]->pb)); use_custom_io[i] = 0; @@ -3295,4 +3300,4 @@ Container_t FFMPEGContainer = "FFMPEG", &Command, FFMPEG_Capabilities -}; \ No newline at end of file +};