Browse Source

fix recording-daemon segfault for libavcodec versions < 57

fixes #462

Change-Id: I62776c1c3d83ccbdc94990fd1f9db43bcf0b0eff
changes/80/19180/1
Richard Fuchs 8 years ago
parent
commit
92e4c28fde
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      recording-daemon/output.c

+ 14
- 0
recording-daemon/output.c View File

@ -84,6 +84,15 @@ int output_config(output_t *output, const format_t *requested_format, format_t *
goto err; goto err;
output->avst->time_base = output->encoder->u.avc.avcctx->time_base; output->avst->time_base = output->encoder->u.avc.avcctx->time_base;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 0, 0)
// move the avcctx to avst as we already have an initialized avcctx
if (output->avst->codec) {
avcodec_close(output->avst->codec);
avcodec_free_context(&output->avst->codec);
}
output->avst->codec = output->encoder->u.avc.avcctx;
#endif
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 26, 0) // exact version? present in 57.56 #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 26, 0) // exact version? present in 57.56
avcodec_parameters_from_context(output->avst->codecpar, output->encoder->u.avc.avcctx); avcodec_parameters_from_context(output->avst->codecpar, output->encoder->u.avc.avcctx);
#endif #endif
@ -134,6 +143,11 @@ static void output_shutdown(output_t *output) {
} }
avformat_free_context(output->fmtctx); avformat_free_context(output->fmtctx);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 0, 0)
// avoid double free - avcctx already freed
output->encoder->u.avc.avcctx = NULL;
#endif
encoder_close(output->encoder); encoder_close(output->encoder);
output->fmtctx = NULL; output->fmtctx = NULL;


Loading…
Cancel
Save