mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
ignore other 264 frame except sps,pps,idr,nonidr
This commit is contained in:
parent
dbc6d94028
commit
a4bb03b9d6
1 changed files with 14 additions and 0 deletions
|
@ -1366,6 +1366,11 @@ int srs_write_h264_raw_frame(Context* context,
|
||||||
char* frame, int frame_size, u_int32_t dts, u_int32_t pts
|
char* frame, int frame_size, u_int32_t dts, u_int32_t pts
|
||||||
) {
|
) {
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// empty frame.
|
||||||
|
if (frame_size <= 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// for sps
|
// for sps
|
||||||
if (context->avc_raw.is_sps(frame, frame_size)) {
|
if (context->avc_raw.is_sps(frame, frame_size)) {
|
||||||
|
@ -1399,6 +1404,15 @@ int srs_write_h264_raw_frame(Context* context,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore others.
|
||||||
|
// 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 nut = (SrsAvcNaluType)(frame[0] & 0x1f);
|
||||||
|
if (nut != SrsAvcNaluTypeSPS && nut != SrsAvcNaluTypePPS && nut != SrsAvcNaluTypeIDR && nut != SrsAvcNaluTypeNonIDR) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// send pps+sps before ipb frames when sps/pps changed.
|
// send pps+sps before ipb frames when sps/pps changed.
|
||||||
if ((ret = srs_write_h264_sps_pps(context, dts, pts)) != ERROR_SUCCESS) {
|
if ((ret = srs_write_h264_sps_pps(context, dts, pts)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue