Skip to content

Commit 18b47e7

Browse files
committed
lavd probe fixes
Fixed incorrectly selected UYVY with following command: uv -t testcard:codec=R12L -c libavcodec:encoder=hevc_nvenc --param force-lavd-decoder=hevc_cuvid -d dummy -V There were 2 problems: 1. probed codec should be returned after first successful decoded frame because in the above case, the decoder offers nv12 via get_frame callback first and it changes later to yuv444p16le if decoding continues and succeeds (see also 2.) 2. get_format_callback() returned VIDEO_CODDC_NONE on probe but that caused subsequent initialization of 'hevc' decoder (because lavd thought that it failed). Because of that, the probe couldn't have proceeded. After the changes, the probed format is R10k (correct for now - get_best_ug_codec_to_av({AV_PIX_FMT_YUV444P16, 0}, 0) returns R10k).
1 parent fb0729b commit 18b47e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/video_decompress/libavcodec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ static enum AVPixelFormat get_format_callback(struct AVCodecContext *s, const en
550550
codec_t c = get_best_ug_codec_to_av(fmt, hwaccel);
551551
if (c != VIDEO_CODEC_NONE) {
552552
state->internal_codec = c;
553-
return AV_PIX_FMT_NONE;
553+
return lavd_get_av_to_ug_codec(fmt, c, hwaccel);
554554
}
555555
} else {
556556
enum AVPixelFormat f = lavd_get_av_to_ug_codec(fmt, state->out_codec, hwaccel);
@@ -965,7 +965,7 @@ static decompress_status libavcodec_decompress(void *state, unsigned char *dst,
965965
}
966966
}
967967

968-
if (s->out_codec == VIDEO_CODEC_NONE && s->internal_codec != VIDEO_CODEC_NONE) {
968+
if (s->out_codec == VIDEO_CODEC_NONE && s->internal_codec != VIDEO_CODEC_NONE && res == DECODER_GOT_FRAME) {
969969
*internal_codec = s->internal_codec;
970970
return DECODER_GOT_CODEC;
971971
}

0 commit comments

Comments
 (0)