From 7aaa74b9e0c470effe5cf770aef21b98043f9933 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 8 Sep 2016 19:56:06 +0800 Subject: [PATCH] TODO: FIXME: for librtmp, must group NALUs to frame. --- trunk/src/libs/srs_librtmp.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index 81018b183..7a65b849d 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -1296,12 +1296,18 @@ int srs_write_h264_ipb_frame(Context* context, // 5bits, 7.3.1 NAL unit syntax, // H.264-AVC-ISO_IEC_14496-10.pdf, page 44. - // 7: SPS, 8: PPS, 5: I Frame, 1: P Frame - SrsAvcNaluType nal_unit_type = (SrsAvcNaluType)(frame[0] & 0x1f); + // 5: I Frame, 1: P/B Frame + // @remark for rtmp, we only need to send the I/P/B frames to server, + // the aud is used for server to remux stream to annexb. + // TODO: FIXME: we must group NALUs between AUD to a frame. + SrsAvcNaluType nut = (SrsAvcNaluType)(frame[0] & 0x1f); + if (nut != SrsAvcNaluTypeIDR && nut != SrsAvcNaluTypeNonIDR) { + return ret; + } // for IDR frame, the frame is keyframe. SrsCodecVideoAVCFrame frame_type = SrsCodecVideoAVCFrameInterFrame; - if (nal_unit_type == SrsAvcNaluTypeIDR) { + if (nut == SrsAvcNaluTypeIDR) { frame_type = SrsCodecVideoAVCFrameKeyFrame; }