Browse Source

avcodec/cuvid: update hw_frames_ctx reference after get_format call

tags/n3.3
Timo Rothenpieler 9 years ago
parent
commit
b7d480f431
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      libavcodec/cuvid.c

+ 13
- 0
libavcodec/cuvid.c View File

@@ -143,6 +143,19 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form

avctx->pix_fmt = surface_fmt;

// Update our hwframe ctx, as the get_format callback might have refreshed it!
if (avctx->hw_frames_ctx) {
av_buffer_unref(&ctx->hwframe);

ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
if (!ctx->hwframe) {
ctx->internal_error = AVERROR(ENOMEM);
return 0;
}

hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
}

avctx->width = format->display_area.right;
avctx->height = format->display_area.bottom;



Loading…
Cancel
Save