winlin

TODO: FIXME: for librtmp, must group NALUs to frame.

@@ -1296,12 +1296,18 @@ int srs_write_h264_ipb_frame(Context* context, @@ -1296,12 +1296,18 @@ int srs_write_h264_ipb_frame(Context* context,
1296 1296
1297 // 5bits, 7.3.1 NAL unit syntax, 1297 // 5bits, 7.3.1 NAL unit syntax,
1298 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44. 1298 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
1299 - // 7: SPS, 8: PPS, 5: I Frame, 1: P Frame  
1300 - SrsAvcNaluType nal_unit_type = (SrsAvcNaluType)(frame[0] & 0x1f); 1299 + // 5: I Frame, 1: P/B Frame
  1300 + // @remark for rtmp, we only need to send the I/P/B frames to server,
  1301 + // the aud is used for server to remux stream to annexb.
  1302 + // TODO: FIXME: we must group NALUs between AUD to a frame.
  1303 + SrsAvcNaluType nut = (SrsAvcNaluType)(frame[0] & 0x1f);
  1304 + if (nut != SrsAvcNaluTypeIDR && nut != SrsAvcNaluTypeNonIDR) {
  1305 + return ret;
  1306 + }
1301 1307
1302 // for IDR frame, the frame is keyframe. 1308 // for IDR frame, the frame is keyframe.
1303 SrsCodecVideoAVCFrame frame_type = SrsCodecVideoAVCFrameInterFrame; 1309 SrsCodecVideoAVCFrame frame_type = SrsCodecVideoAVCFrameInterFrame;
1304 - if (nal_unit_type == SrsAvcNaluTypeIDR) { 1310 + if (nut == SrsAvcNaluTypeIDR) {
1305 frame_type = SrsCodecVideoAVCFrameKeyFrame; 1311 frame_type = SrsCodecVideoAVCFrameKeyFrame;
1306 } 1312 }
1307 1313