Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5599930

Browse files
Process specified device sps nal data
Test in p7 phone.
1 parent 3c3f60c commit 5599930

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ 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 AVC2_SPS_NAL = 39; // 0<<7 + 1<<5 + 7<<0
3234

3335
/**
3436
* @return ByteBuffer contains SPS without NAL header.
@@ -40,9 +42,12 @@ public static ByteBuffer getSpsBuffer(MediaFormat format) {
4042
prefixedSpsBuffer.flip();
4143

4244
skipStartCode(prefixedSpsBuffer);
43-
if (prefixedSpsBuffer.get() != AVC_SPS_NAL) {
45+
46+
byte spsNalData = prefixedSpsBuffer.get();
47+
if (spsNalData != AVC_SPS_NAL && spsNalData != AVC2_SPS_NAL) {
4448
throw new IllegalStateException("Got non SPS NAL data.");
4549
}
50+
4651
return prefixedSpsBuffer.slice();
4752
}
4853

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /