mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
vtenc: Disable HW acceleration for interlaced ProRes
Due to a bug in the VT API, attempting to encode interlaced content with ProRes results in an error, halting the pipeline instead of gracefully falling back to software encoding. Should be removed in the future if Apple ever fixes this issue. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3222>
This commit is contained in:
parent
60731adea6
commit
ae200a4d62
1 changed files with 12 additions and 1 deletions
|
@ -1208,11 +1208,22 @@ gst_vtenc_create_session (GstVTEnc * self)
|
||||||
const GstVTEncoderDetails *codec_details =
|
const GstVTEncoderDetails *codec_details =
|
||||||
GST_VTENC_CLASS_GET_CODEC_DETAILS (G_OBJECT_GET_CLASS (self));
|
GST_VTENC_CLASS_GET_CODEC_DETAILS (G_OBJECT_GET_CLASS (self));
|
||||||
|
|
||||||
|
/* Apple's M1 hardware encoding fails when provided with an interlaced ProRes source.
|
||||||
|
* It's most likely a bug in VideoToolbox, as no such limitation has been officially mentioned anywhere.
|
||||||
|
* For now let's disable HW encoding entirely when such case occurs. */
|
||||||
|
gboolean enable_hw = !(GST_VIDEO_INFO_IS_INTERLACED (&self->video_info)
|
||||||
|
&& codec_details->format_id == GST_kCMVideoCodecType_Some_AppleProRes);
|
||||||
|
|
||||||
|
if (!enable_hw)
|
||||||
|
GST_WARNING_OBJECT (self,
|
||||||
|
"Interlaced content detected, disabling HW-accelerated encoding due to https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1429");
|
||||||
|
|
||||||
encoder_spec =
|
encoder_spec =
|
||||||
CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
|
CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
|
||||||
&kCFTypeDictionaryValueCallBacks);
|
&kCFTypeDictionaryValueCallBacks);
|
||||||
gst_vtutil_dict_set_boolean (encoder_spec,
|
gst_vtutil_dict_set_boolean (encoder_spec,
|
||||||
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, true);
|
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,
|
||||||
|
enable_hw);
|
||||||
if (codec_details->require_hardware)
|
if (codec_details->require_hardware)
|
||||||
gst_vtutil_dict_set_boolean (encoder_spec,
|
gst_vtutil_dict_set_boolean (encoder_spec,
|
||||||
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder,
|
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder,
|
||||||
|
|
Loading…
Reference in a new issue