Fix for issue #62 (slow internet streams), credit @chme

This commit is contained in:
ejurgensen 2015-01-02 23:24:44 +01:00
parent d55d194201
commit 2879458e98
4 changed files with 20 additions and 2 deletions

View File

@ -163,7 +163,7 @@ dnl Check for av_lock_manager (ffmpeg >= 0.5.1)
AC_CHECK_LIB([avcodec], [av_lockmgr_register], , AC_MSG_ERROR([libav (ffmpeg) >= 0.5.1 required]))
dnl Check for avcodec_find_best_pix_fmt_of_list (is only in ffmpeg, not libav)
AC_CHECK_LIB([avcodec], [avcodec_find_best_pix_fmt_of_list],
AC_DEFINE(FFMPEG_INCOMPATIBLE_API, 1, [Define to 1 if you have ffmpeg (and not libav).]))
AC_DEFINE(HAVE_FFMPEG, 1, [Define to 1 if you have ffmpeg (and not libav).]))
LIBS="$save_LIBS"
# Check for libavformat >= 53; url -> avio switch

View File

@ -314,7 +314,7 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, struct ev
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 55 || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR >= 35)
# ifndef FFMPEG_INCOMPATIBLE_API
# ifndef HAVE_FFMPEG
dst->pix_fmt = avcodec_find_best_pix_fmt2((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL);
# else
dst->pix_fmt = avcodec_find_best_pix_fmt_of_list((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL);

View File

@ -415,6 +415,15 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
options = NULL;
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 3)
# ifndef HAVE_FFMPEG
// Without this, libav is slow to probe some internet streams
if (mfi->data_kind == 1)
{
ctx = avformat_alloc_context();
ctx->probesize = 64000;
}
# endif
if (mfi->data_kind == 1)
av_dict_set(&options, "icy", "1", 0);

View File

@ -498,6 +498,15 @@ transcode_setup(struct transcode_ctx **nctx, struct media_file_info *mfi, off_t
memset(ctx, 0, sizeof(struct transcode_ctx));
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 3)
# ifndef HAVE_FFMPEG
// Without this, libav is slow to probe some internet streams, which leads to RAOP timeouts
if (mfi->data_kind == 1)
{
ctx->fmtctx = avformat_alloc_context();
ctx->fmtctx->probesize = 64000;
}
# endif
ret = avformat_open_input(&ctx->fmtctx, mfi->path, NULL, NULL);
#else
ret = av_open_input_file(&ctx->fmtctx, mfi->path, NULL, 0, NULL);