mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
x264enc: fix up avcC header construction and playback by flash players
Fix off-by-one bug when constructing the avcC header chunk: we wrote wrong profile info into the header. The first byte in the SPS NAL we get from x264 is the nal type, not the profile_idc. Also add some debug logging. Fixes #610089.
This commit is contained in:
parent
ad45fd1827
commit
35dd89951d
1 changed files with 9 additions and 3 deletions
|
@ -738,6 +738,10 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
GST_MEMDUMP ("SEI", nal[0].p_payload, nal[0].i_payload);
|
||||
GST_MEMDUMP ("SPS", nal[1].p_payload, nal[1].i_payload);
|
||||
GST_MEMDUMP ("PPS", nal[2].p_payload, nal[2].i_payload);
|
||||
|
||||
/* nal payloads with emulation_prevention_three_byte, and some header data */
|
||||
buffer_size = (nal[1].i_payload + nal[2].i_payload) * 4 + 100;
|
||||
buffer = g_malloc (buffer_size);
|
||||
|
@ -751,9 +755,9 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
|
|||
#endif
|
||||
|
||||
buffer[0] = 1; /* AVC Decoder Configuration Record ver. 1 */
|
||||
buffer[1] = sps[0]; /* profile_idc */
|
||||
buffer[2] = sps[1]; /* profile_compability */
|
||||
buffer[3] = sps[2]; /* level_idc */
|
||||
buffer[1] = sps[1]; /* profile_idc */
|
||||
buffer[2] = sps[2]; /* profile_compability */
|
||||
buffer[3] = sps[3]; /* level_idc */
|
||||
buffer[4] = 0xfc | (4 - 1); /* nal_length_size_minus1 */
|
||||
|
||||
i_size = 5;
|
||||
|
@ -786,6 +790,8 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
|
|||
memcpy (GST_BUFFER_DATA (buf), buffer, i_size);
|
||||
g_free (buffer);
|
||||
|
||||
GST_MEMDUMP ("header", GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue