vtenc: Fix negotiation failure with profile=main-422-10
Previous version passed just enough data to the parser to detect main/main-10, but main-422-10 is one of the range extensions profiles. Those need a few more bits to be accurately detected, and since those were just uinitialized memory previously, we'd incorrectly end up with main or main-10 when the encoder was in fact giving us 4:2:2 10bit output. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9348>
This commit is contained in:
parent
dabb3eb5bd
commit
c43d3900bf
@ -1163,7 +1163,6 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf)
|
||||
guint8 *codec_data;
|
||||
gsize codec_data_size;
|
||||
GstBuffer *codec_data_buf;
|
||||
guint8 sps[12];
|
||||
|
||||
fmt = CMSampleBufferGetFormatDescription (sbuf);
|
||||
atoms = CMFormatDescriptionGetExtension (fmt,
|
||||
@ -1189,10 +1188,27 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf)
|
||||
|
||||
if (self->details->format_id == kCMVideoCodecType_HEVC ||
|
||||
self->details->format_id == kCMVideoCodecType_HEVCWithAlpha) {
|
||||
sps[0] = codec_data[1];
|
||||
sps[11] = codec_data[12];
|
||||
gst_codec_utils_h265_caps_set_level_tier_and_profile (caps, sps, 12);
|
||||
if (codec_data_size < 1 + 12) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Codec data malformed, can't parse profile and level");
|
||||
gst_buffer_unref (codec_data_buf);
|
||||
gst_caps_unref (caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_codec_utils_h265_caps_set_level_tier_and_profile (caps,
|
||||
&codec_data[1], 12);
|
||||
} else {
|
||||
guint8 sps[3];
|
||||
|
||||
if (codec_data_size < 1 + 3) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Codec data malformed, can't parse profile and level");
|
||||
gst_buffer_unref (codec_data_buf);
|
||||
gst_caps_unref (caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sps[0] = codec_data[1];
|
||||
sps[1] = codec_data[2] & ~0xDF;
|
||||
sps[2] = codec_data[3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user