From d7295b8630994d72424c87e6a491181bf3774a53 Mon Sep 17 00:00:00 2001 From: max_10 Date: Tue, 26 Feb 2019 21:10:10 +0100 Subject: [PATCH 1/5] Revert "try fix to call container_ffmpeg_stop on file EOF" This reverts commit 3acfc0ce33e8cfa0af2e7d8dda3c7f64bac962dc. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/3d213ed65f2efa103e838c19266a0e2fbbff0d9d Author: max_10 Date: 2019-02-26 (Tue, 26 Feb 2019) ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 4692b4e..074155c 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -126,7 +126,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length); static int64_t calcPts(uint32_t avContextIdx, AVStream *stream, int64_t pts); static int64_t doCalcPts(int64_t start_time, const AVRational time_base, int64_t pts); -static int32_t container_ffmpeg_stop(Context_t *context); /* Progressive playback means that we play local file * but this local file can grows up, for example @@ -1353,11 +1352,6 @@ static void FFMPEGThread(Context_t *context) do_seek_target_seconds = 0; PlaybackDieNow(1); - if(context && context->playback) - { - container_ffmpeg_stop(context); - } - ffmpeg_printf(10, "terminating\n"); } @@ -1539,7 +1533,8 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin 0 == strncmp(filename, "file://", 7)) { AVIOContext *avio_ctx = NULL; - custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t)); + if(custom_io_tab[AVIdx] == NULL)//workaround for double malloc if container_ffmpeg_stop is not called after file play to end + custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t)); memset(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t)); From 83d9b453fcfcb1907a633c112b54a4dbc325fe14 Mon Sep 17 00:00:00 2001 From: max_10 Date: Tue, 26 Feb 2019 21:10:32 +0100 Subject: [PATCH 2/5] Revert "workaround for double malloc if container_ffmpeg_stop is not called after file play to end" This reverts commit 2d9b643ac65276cec7825eb2ce30c7dd462b4ced. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/9736caf6d9f9aa0e1e94d205e462ab9169a0005e Author: max_10 Date: 2019-02-26 (Tue, 26 Feb 2019) ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 074155c..ea9fb36 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -1533,9 +1533,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin 0 == strncmp(filename, "file://", 7)) { AVIOContext *avio_ctx = NULL; - if(custom_io_tab[AVIdx] == NULL)//workaround for double malloc if container_ffmpeg_stop is not called after file play to end - custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t)); - + custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t)); memset(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t)); custom_io_tab[AVIdx]->szFile = filename; @@ -2733,11 +2731,7 @@ static int32_t container_ffmpeg_stop(Context_t *context) fclose(io->pFile); if (io->pMoovFile) fclose(io->pMoovFile); - if(custom_io_tab[i] != NULL) - { - free(custom_io_tab[i]); - custom_io_tab[i] = NULL; - } + free(custom_io_tab[i]); av_freep(&(avContextTab[i]->pb->buffer)); av_freep(&(avContextTab[i]->pb)); use_custom_io[i] = 0; From 636984ed48dda82dd8a3daa3b33429977f5a75cc Mon Sep 17 00:00:00 2001 From: max_10 Date: Wed, 27 Feb 2019 12:24:05 +0100 Subject: [PATCH 3/5] Revert "try to fix slowly close internet radio/music player" This reverts commit 65dc5d1363158c52db31be727f10a8ef036bff77. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/5cfe8e97cceebe9913936a7bba0011df0663081b Author: max_10 Date: 2019-02-27 (Wed, 27 Feb 2019) ------------------ This commit was generated by Migit --- libarmbox/audio.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libarmbox/audio.cpp b/libarmbox/audio.cpp index 9fc7101..85bf78d 100644 --- a/libarmbox/audio.cpp +++ b/libarmbox/audio.cpp @@ -314,7 +314,7 @@ int cAudio::WriteClip(unsigned char *buffer, int size) int cAudio::StopClip() { hal_debug("%s\n", __FUNCTION__); -#if 0 + if (clipfd < 0) { hal_info("%s: clipfd not yet opened\n", __FUNCTION__); return -1; @@ -326,7 +326,6 @@ int cAudio::StopClip() mixer_fd = -1; } setVolume(volume, volume); -#endif return 0; }; From 17f92a96d085ebe01b9ea6f26663b1e118c4f46d Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Wed, 27 Feb 2019 13:46:58 +0100 Subject: [PATCH 4/5] fix possible segfault arm hardware, thx DboxOldie Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/50df0bcfaca68ab92ac5794a3f6791ea3a35b7cf Author: Frankenstone Date: 2019-02-27 (Wed, 27 Feb 2019) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/audio.cpp | 10 +++++----- libarmbox/video.cpp | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libarmbox/audio.cpp b/libarmbox/audio.cpp index 85bf78d..48e3d6b 100644 --- a/libarmbox/audio.cpp +++ b/libarmbox/audio.cpp @@ -97,7 +97,7 @@ int map_volume(const int volume) int cAudio::setVolume(unsigned int left, unsigned int right) { - hal_debug("%s(%d, %d)\n", __func__, left, right); + hal_info("cAudio::%s(%d, %d)\n", __func__, left, right); volume = (left + right) / 2; int v = map_volume(volume); @@ -199,7 +199,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) unsigned int devmask, stereo, usable; const char *dsp_dev = getenv("DSP_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE"); - hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); + hal_info("cAudio::%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); if (clipfd > -1) { hal_info("%s: clipfd already opened (%d)\n", __func__, clipfd); return -1; @@ -226,7 +226,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) " fall back to /dev/mixer\n", __func__, dsp_dev); mix_dev = "/dev/mixer"; } - hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ + hal_info("cAudio::%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ /* the tdoss dsp driver seems to work only on the second open(). really. */ clipfd = open(dsp_dev, O_WRONLY); if (clipfd < 0) { @@ -313,7 +313,7 @@ int cAudio::WriteClip(unsigned char *buffer, int size) int cAudio::StopClip() { - hal_debug("%s\n", __FUNCTION__); + hal_info("cAudio::%s\n", __FUNCTION__); if (clipfd < 0) { hal_info("%s: clipfd not yet opened\n", __FUNCTION__); @@ -321,7 +321,7 @@ int cAudio::StopClip() } close(clipfd); clipfd = -1; - if (mixer_fd >= -1) { + if (mixer_fd > -1) { close(mixer_fd); mixer_fd = -1; } diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index a8c15b3..20b8509 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -276,8 +276,10 @@ AVCodecContext* open_codec(AVMediaType mediaType, AVFormatContext* formatContext int image_to_mpeg2(const char *image_name, int fd) { int ret = 0; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); avcodec_register_all(); +#endif AVFormatContext *formatContext = avformat_alloc_context(); if (formatContext && (ret = avformat_open_input(&formatContext, image_name, NULL, NULL)) == 0){ From befac2b6b4870ab500fe1897b4e4d76b0f1e5b97 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Wed, 27 Feb 2019 14:04:05 +0100 Subject: [PATCH 5/5] fix possible segfault sh4 hardware Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/2c1759fe2e51905739f557021bd3f5aa3267d07b Author: Frankenstone Date: 2019-02-27 (Wed, 27 Feb 2019) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/audio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libspark/audio.cpp b/libspark/audio.cpp index f725a64..25a05a8 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -322,7 +322,7 @@ int cAudio::StopClip() } close(clipfd); clipfd = -1; - if (mixer_fd >= -1) { + if (mixer_fd > -1) { close(mixer_fd); mixer_fd = -1; }