@@ -29,6 +29,9 @@ public class AvcCsdUtils {
2929 private  static  final  byte [] AVC_START_CODE_4  = {0x00 , 0x00 , 0x00 , 0x01 };
3030 // Refer: http://www.cardinalpeak.com/blog/the-h-264-sequence-parameter-set/ 
3131 private  static  final  byte  AVC_SPS_NAL  = 103 ; // 0<<7 + 3<<5 + 7<<0 
32+  // https://tools.ietf.org/html/rfc6184 
33+  private  static  final  byte  AVC_SPS_NAL_2  = 39 ; // 0<<7 + 1<<5 + 7<<0 
34+  private  static  final  byte  AVC_SPS_NAL_3  = 71 ; // 0<<7 + 2<<5 + 7<<0 
3235
3336 /** 
3437 * @return ByteBuffer contains SPS without NAL header. 
@@ -40,9 +43,12 @@ public static ByteBuffer getSpsBuffer(MediaFormat format) {
4043 prefixedSpsBuffer .flip ();
4144
4245 skipStartCode (prefixedSpsBuffer );
43-  if  (prefixedSpsBuffer .get () != AVC_SPS_NAL ) {
46+ 47+  byte  spsNalData  = prefixedSpsBuffer .get ();
48+  if  (spsNalData  != AVC_SPS_NAL  && spsNalData  != AVC_SPS_NAL_2  && spsNalData  != AVC_SPS_NAL_3 ) {
4449 throw  new  IllegalStateException ("Got non SPS NAL data." );
4550 }
51+ 4652 return  prefixedSpsBuffer .slice ();
4753 }
4854
0 commit comments