1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

GB: Fix PSM parsing indicator bug (#3383)

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
Haibo Chen 2023-01-17 13:01:36 +08:00 committed by GitHub
parent dbc8e8ca87
commit a78936f517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,17 +427,18 @@ srs_error_t SrsPsPsmPacket::decode(SrsBuffer* stream)
return srs_error_new(ERROR_GB_PS_HEADER, "requires 4 only %d bytes", stream->left()); return srs_error_new(ERROR_GB_PS_HEADER, "requires 4 only %d bytes", stream->left());
} }
uint16_t r0 = stream->read_2bytes(); uint8_t r0 = stream->read_1bytes();
if ((r0&0x01) != 0x01) { program_stream_map_version_ = r0&0x1f;
return srs_error_new(ERROR_GB_PS_HEADER, "invalid marker of 0x%#x", r0); current_next_indicator_ = (r0>>7) & 0x01;
}
program_stream_map_version_ = (uint8_t)(r0&0x1f);
current_next_indicator_ = (uint8_t)((r0>>7) & 0x01);
if (!current_next_indicator_) { if (!current_next_indicator_) {
return srs_error_new(ERROR_GB_PS_HEADER, "invalid indicator of 0x%#x", r0); return srs_error_new(ERROR_GB_PS_HEADER, "invalid indicator of 0x%#x", r0);
} }
uint8_t r1 = stream->read_1bytes();
if ((r1&0x01) != 0x01) {
return srs_error_new(ERROR_GB_PS_HEADER, "invalid marker of 0x%#x", r1);
}
program_stream_info_length_ = stream->read_2bytes(); program_stream_info_length_ = stream->read_2bytes();
if (!stream->require(program_stream_info_length_)) { if (!stream->require(program_stream_info_length_)) {
return srs_error_new(ERROR_GB_PS_HEADER, "requires %d only %d bytes", program_stream_info_length_, stream->left()); return srs_error_new(ERROR_GB_PS_HEADER, "requires %d only %d bytes", program_stream_info_length_, stream->left());