mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
H265: Support HEVC over HTTP-TS. v6.0.4 (#3275)
1. Update TS video codec to HEVC during streaming. 2. Return error when HEVC is disabled. 3. Parse HEVC NALU type by SrsHevcNaluTypeParse. 4. Show message when codec change for TS. Co-authored-by: runner365 <shi.weibd@hotmail.com>
This commit is contained in:
parent
8debbe6db8
commit
70d5618979
10 changed files with 178 additions and 33 deletions
|
@ -620,11 +620,11 @@ srs_error_t SrsVideoFrame::add_sample(char* bytes, int size)
|
|||
// For HEVC(H.265), try to parse the IDR from NALUs.
|
||||
if (c && c->id == SrsVideoCodecIdHEVC) {
|
||||
#ifdef SRS_H265
|
||||
SrsHevcNaluType nalu_type = (SrsHevcNaluType)(uint8_t)((bytes[0] & 0x3f) >> 1);
|
||||
SrsHevcNaluType nalu_type = SrsHevcNaluTypeParse(bytes[0]);
|
||||
has_idr = (SrsHevcNaluType_CODED_SLICE_BLA <= nalu_type) && (nalu_type <= SrsHevcNaluType_RESERVED_23);
|
||||
return err;
|
||||
#else
|
||||
return srs_error_new(ERROR_HLS_DECODE_ERROR, "H.265 is disabled");
|
||||
return srs_error_new(ERROR_HEVC_DISABLED, "H.265 is disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -854,7 +854,7 @@ srs_error_t SrsFormat::video_avc_demux(SrsBuffer* stream, int64_t timestamp)
|
|||
}
|
||||
return err;
|
||||
#else
|
||||
return srs_error_new(ERROR_HLS_DECODE_ERROR, "H.265 is disabled");
|
||||
return srs_error_new(ERROR_HEVC_DISABLED, "H.265 is disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1373,7 +1373,7 @@ srs_error_t SrsFormat::video_nalu_demux(SrsBuffer* stream)
|
|||
// TODO: FIXME: Might need to guess format?
|
||||
return do_avc_demux_ibmf_format(stream);
|
||||
#else
|
||||
return srs_error_new(ERROR_HLS_DECODE_ERROR, "H.265 is disabled");
|
||||
return srs_error_new(ERROR_HEVC_DISABLED, "H.265 is disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1500,6 +1500,7 @@ srs_error_t SrsFormat::do_avc_demux_ibmf_format(SrsBuffer* stream)
|
|||
// 5.3.4.2.1 Syntax, ISO_IEC_14496-15-AVC-format-2012.pdf, page 20
|
||||
for (int i = 0; i < PictureLength;) {
|
||||
// unsigned int((NAL_unit_length+1)*8) NALUnitLength;
|
||||
// TODO: FIXME: Should ignore error? See https://github.com/ossrs/srs-gb28181/commit/a13b9b54938a14796abb9011e7a8ee779439a452
|
||||
if (!stream->require(vcodec->NAL_unit_length + 1)) {
|
||||
return srs_error_new(ERROR_HLS_DECODE_ERROR, "PictureLength:%d, i:%d, NaluLength:%d, left:%d",
|
||||
PictureLength, i, vcodec->NAL_unit_length, stream->left());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue