@@ -1315,6 +1315,10 @@ srs_error_t SrsLazyGbMediaTcpConn::cycle()
1315
1315
{
1316
1316
srs_error_t err = do_cycle ();
1317
1317
1318
+ // Should disconnect the TCP connection when stop cycle, especially when we stop first. In this situation, the
1319
+ // connection won't be closed because it's shared by other objects.
1320
+ srs_freep (conn_);
1321
+
1318
1322
// Change state to disconnected.
1319
1323
connected_ = false ;
1320
1324
srs_trace (" PS: Media disconnect, code=%d" , srs_error_code (err));
@@ -1642,10 +1646,19 @@ srs_error_t SrsGbMuxer::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
1642
1646
// 5bits, 7.3.1 NAL unit syntax,
1643
1647
// ISO_IEC_14496-10-AVC-2003.pdf, page 44.
1644
1648
// 7: SPS, 8: PPS, 5: I Frame, 1: P Frame
1645
- SrsAvcNaluType nal_unit_type = (SrsAvcNaluType)(frame[0 ] & 0x1f );
1646
-
1647
- // ignore the nalu type sps(7), pps(8), aud(9)
1648
- if (nal_unit_type == SrsAvcNaluTypeAccessUnitDelimiter) {
1649
+ SrsAvcNaluType nt = (SrsAvcNaluType)(frame[0 ] & 0x1f );
1650
+
1651
+ // Ignore the nalu except video frames:
1652
+ // 7: SPS, 8: PPS, 5: I Frame, 1: P Frame, 6: SEI, 9: AUD
1653
+ if (
1654
+ nt != SrsAvcNaluTypeSPS && nt != SrsAvcNaluTypePPS && nt != SrsAvcNaluTypeIDR &&
1655
+ nt != SrsAvcNaluTypeNonIDR && nt != SrsAvcNaluTypeSEI && nt != SrsAvcNaluTypeAccessUnitDelimiter
1656
+ ) {
1657
+ string bytes = srs_string_dumps_hex (frame, frame_size, 4 );
1658
+ srs_warn (" GB: Ignore NALU nt=%d, frame=[%s]" , nt, bytes.c_str ());
1659
+ return err;
1660
+ }
1661
+ if (nt == SrsAvcNaluTypeSEI || nt == SrsAvcNaluTypeAccessUnitDelimiter) {
1649
1662
continue ;
1650
1663
}
1651
1664
@@ -2392,6 +2405,11 @@ srs_error_t SrsRecoverablePsContext::decode(SrsBuffer* stream, ISrsPsMessageHand
2392
2405
return enter_recover_mode (stream, handler, stream->pos (), srs_error_wrap (err, " decode pack" ));
2393
2406
}
2394
2407
2408
+ // Check stream type, error if HEVC, because not supported yet.
2409
+ if (ctx_.video_stream_type_ == SrsTsStreamVideoHEVC) {
2410
+ return srs_error_new (ERROR_GB_PS_HEADER, " HEVC is not supported" );
2411
+ }
2412
+
2395
2413
return err;
2396
2414
}
2397
2415
0 commit comments