encoder: h264: fix NAL unit types in packed headers.

Submit Prefix NAL headers (nal_unit_type = 14) before every packed
slice header (nal_unit_type = 1 or 5) only for the base view. In non
base views, a Coded Slice Extension NAL header (nal_unit_type = 20)
is required, with an appropriate nal_unit_header_mvc_extension() in
the NAL header bytes.

https://bugzilla.gnome.org/show_bug.cgi?id=732083
This commit is contained in:
Sreerenj Balachandran 2014-06-26 11:39:38 +03:00 committed by Gwenole Beauchesne
parent a7c27bb7d5
commit 173f32d8e5

View file

@ -1479,7 +1479,12 @@ add_packed_slice_header (GstVaapiEncoderH264 * encoder,
if (!get_nal_hdr_attributes (picture, &nal_ref_idc, &nal_unit_type))
goto bs_error;
bs_write_nal_header (&bs, nal_ref_idc, nal_unit_type);
/* pack nal_unit_header_mvc_extension() for the non base view */
if (encoder->is_mvc && encoder->view_idx) {
bs_write_nal_header (&bs, nal_ref_idc, GST_H264_NAL_SLICE_EXT);
bs_write_nal_header_mvc_extension (&bs, picture, encoder->view_idx);
} else
bs_write_nal_header (&bs, nal_ref_idc, nal_unit_type);
bs_write_slice (&bs, slice_param, encoder, picture);
data_bit_size = GST_BIT_WRITER_BIT_SIZE (&bs);
@ -1887,8 +1892,10 @@ add_slice_headers (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
/* set calculation for next slice */
last_mb_index += cur_slice_mbs;
if (encoder->is_mvc &&
(GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & VA_ENC_PACKED_HEADER_RAW_DATA)
/* add packed Prefix NAL unit before each Coded slice NAL in base view */
if (encoder->is_mvc && !encoder->view_idx &&
(GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) &
VA_ENC_PACKED_HEADER_RAW_DATA)
&& !add_packed_prefix_nal_header (encoder, picture, slice))
goto error_create_packed_prefix_nal_hdr;
if ((GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) &