]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugins-ugly0-10.git/commitdiff
x264enc: fix up avcC header construction and playback by flash players
authorVittorio Palmisano <vpalmisano@gmail.com>
Tue, 16 Feb 2010 13:25:11 +0000 (13:25 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 16 Feb 2010 13:33:10 +0000 (13:33 +0000)
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.

ext/x264/gstx264enc.c

index d80e3bf821d8a4756314faba7548ae4847c87c31..7d545d514c68a994eb5476d992e0f303ecd839d1 100644 (file)
@@ -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;
 }