mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-02 09:33:33 +00:00
deps/media-playback: Fix hardware decoding of streams
Fixes issue #10369.
Since the update to FFmpeg 6.1, streams to a Media Source are broken
if hardware decoding is enabled (both RTMP or SRT have been reported).
The video is black although the audio is decoded fine.
The manual copy of metadata introduced in commit [1] does not work any
more for some unfathomable reasons.
As a fix we call instead the av_frame_copy_props function used in FFmpeg
app in a similar context (hardware decoding) [2].
The metadata are copied without issues.
There is no need to guard the use of that function since it was
introduced 9 years ago in avutil/frame.c.
[1] 22fde5cdcd
[2] https://github.com/FFmpeg/FFmpeg/master/fftools/ffmpeg_dec.c
Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
parent
21f1c155ef
commit
41f07913e5
9
deps/media-playback/media-playback/decode.c
vendored
9
deps/media-playback/media-playback/decode.c
vendored
|
@ -338,15 +338,12 @@ static int decode_packet(struct mp_decode *d, int *got_frame)
|
|||
}
|
||||
|
||||
int err = av_hwframe_transfer_data(d->sw_frame, d->hw_frame, 0);
|
||||
if (err == 0) {
|
||||
err = av_frame_copy_props(d->sw_frame, d->hw_frame);
|
||||
}
|
||||
if (err) {
|
||||
ret = 0;
|
||||
*got_frame = false;
|
||||
} else {
|
||||
d->sw_frame->color_range = d->hw_frame->color_range;
|
||||
d->sw_frame->color_primaries =
|
||||
d->hw_frame->color_primaries;
|
||||
d->sw_frame->color_trc = d->hw_frame->color_trc;
|
||||
d->sw_frame->colorspace = d->hw_frame->colorspace;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue