mirror of https://github.com/mpv-player/mpv
vd_lavc: select correct hw decoder profile for constrained baseline h264
The existing code tried to remove the "extra" profile flags for h264. FF_PROFILE_H264_INTRA doesn't matter for us at all, because it's set only for profiles the vdpau/vaapi APIs don't support. The FF_PROFILE_H264_CONSTRAINED flag on the other hand is added to H264_BASELINE, except that it makes the file a real subset of H264_MAIN and H264_HIGH. Removing that flag would select the BASELINE profile, which appears to be rarely supported by hardware decoders. This means we accidentally rejected perfectly hardware decodable files. Use MAIN for it instead. (vaapi has explicit support for CONSTRAINED_BASELINE, but it seems to be a new thing, and is not reported as supported where I tried. So don't bother to check it, and do the same as on vdpau.) See github issue #204.
This commit is contained in:
parent
597a143ec6
commit
467ad4413e
|
@ -151,8 +151,10 @@ const struct hwdec_profile_entry *hwdec_find_profile(
|
|||
enum AVCodecID codec = ctx->avctx->codec_id;
|
||||
int profile = ctx->avctx->profile;
|
||||
// Assume nobody cares about these aspects of the profile
|
||||
if (codec == AV_CODEC_ID_H264)
|
||||
profile &= ~(FF_PROFILE_H264_CONSTRAINED | FF_PROFILE_H264_INTRA);
|
||||
if (codec == AV_CODEC_ID_H264) {
|
||||
if (profile == FF_PROFILE_H264_CONSTRAINED_BASELINE)
|
||||
profile = FF_PROFILE_H264_MAIN;
|
||||
}
|
||||
for (int n = 0; table[n].av_codec; n++) {
|
||||
if (table[n].av_codec == codec) {
|
||||
if (table[n].ff_profile == FF_PROFILE_UNKNOWN ||
|
||||
|
|
Loading…
Reference in New Issue