Ignore annexb exception processing

Some devices produce unstandard H.264 slice without startcode. So we
ignore the annexb exception processing since it does not matter for
streaming.

Signed-off-by: Leo Ma <begeekmyfriend@gmail.com>
camera2
Leo Ma 8 years ago
parent 88dd496f1a
commit da8ca49ebb

@ -634,24 +634,16 @@ public class SrsFlvMuxer {
}
public SrsFlvFrameBytes demuxAnnexb(ByteBuffer bb, MediaCodec.BufferInfo bi) {
SrsFlvFrameBytes tbb = new SrsFlvFrameBytes();
while (bb.position() < bi.size) {
// each frame must prefixed by annexb format.
// about annexb, @see H.264-AVC-ISO_IEC_14496-10.pdf, page 211.
SrsAnnexbSearch tbbsc = searchAnnexb(bb, bi);
if (!tbbsc.match || tbbsc.nb_start_code < 3) {
Log.e(TAG, "annexb not match.");
mHandler.notifyRtmpIllegalArgumentException(new IllegalArgumentException(
String.format("annexb not match for %dB, pos=%d", bi.size, bb.position())));
}
// the start codes.
for (int i = 0; i < tbbsc.nb_start_code; i++) {
bb.get();
}
// find out the frame size.
SrsFlvFrameBytes tbb = new SrsFlvFrameBytes();
tbb.data = bb.slice();
int pos = bb.position();
while (bb.position() < bi.size) {
@ -663,9 +655,6 @@ public class SrsFlvMuxer {
}
tbb.size = bb.position() - pos;
break;
}
return tbb;
}
}

Loading…
Cancel
Save