1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge branch '2.0release' into develop

This commit is contained in:
winlin 2016-08-18 11:29:22 +08:00
commit bf22acd689
2 changed files with 15 additions and 0 deletions

View file

@ -1392,6 +1392,11 @@ int srs_write_h264_raw_frame(Context* context,
char* frame, int frame_size, u_int32_t dts, u_int32_t pts
) {
int ret = ERROR_SUCCESS;
// empty frame.
if (frame_size <= 0) {
return ret;
}
// for sps
if (context->avc_raw.is_sps(frame, frame_size)) {
@ -1425,6 +1430,15 @@ int srs_write_h264_raw_frame(Context* context,
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.
if ((ret = srs_write_h264_sps_pps(context, dts, pts)) != ERROR_SUCCESS) {
return ret;