Skip to content

Commit 762429e

Browse files
add handle avc sps nal data
1 parent 5599930 commit 762429e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/src/main/java/net/ypresto/androidtranscoder/utils/AvcCsdUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public class AvcCsdUtils {
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
3232
// https://tools.ietf.org/html/rfc6184
33-
private static final byte AVC2_SPS_NAL = 39; // 0<<7 + 1<<5 + 7<<0
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
3435

3536
/**
3637
* @return ByteBuffer contains SPS without NAL header.
@@ -44,7 +45,7 @@ public static ByteBuffer getSpsBuffer(MediaFormat format) {
4445
skipStartCode(prefixedSpsBuffer);
4546

4647
byte spsNalData = prefixedSpsBuffer.get();
47-
if (spsNalData != AVC_SPS_NAL && spsNalData != AVC2_SPS_NAL) {
48+
if (spsNalData != AVC_SPS_NAL && spsNalData != AVC_SPS_NAL_2 && spsNalData != AVC_SPS_NAL_3) {
4849
throw new IllegalStateException("Got non SPS NAL data.");
4950
}
5051

0 commit comments

Comments
 (0)