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

GB28181: Fix bug for parsing GB to RTC.

This commit is contained in:
winlin 2022-10-06 20:59:30 +08:00
parent 5a420ece3b
commit c12deded98
14 changed files with 122 additions and 62 deletions

View file

@ -1745,7 +1745,7 @@ srs_error_t SrsGbMuxer::write_h264_ipb_frame(char* frame, int frame_size, uint32
// when sps or pps not sent, ignore the packet.
if (!h264_sps_pps_sent_) {
return srs_error_new(ERROR_H264_DROP_BEFORE_SPS_PPS, "drop sps/pps");
return srs_error_new(ERROR_H264_DROP_BEFORE_SPS_PPS, "drop for no sps/pps");
}
// 5bits, 7.3.1 NAL unit syntax,
@ -1892,6 +1892,9 @@ srs_error_t SrsGbMuxer::connect()
return err;
}
// Cleanup the data before connect again.
close();
string url = srs_string_replace(output_, "[stream]", session_->sip_transport()->resource()->device_id());
srs_trace("Muxer: Convert GB to RTMP %s", url.c_str());
@ -1915,6 +1918,14 @@ srs_error_t SrsGbMuxer::connect()
void SrsGbMuxer::close()
{
srs_freep(sdk_);
// Regenerate the AAC sequence header.
aac_specific_config_ = "";
// Wait for the next AVC sequence header.
h264_sps_pps_sent_ = false;
h264_sps_ = "";
h264_pps_ = "";
}
SrsSipResponseWriter::SrsSipResponseWriter(ISrsProtocolReadWriter* io) : SrsHttpResponseWriter(io)

View file

@ -82,8 +82,14 @@ srs_error_t aac_raw_append_adts_header(SrsSharedPtrMessage* shared_audio, SrsFor
return err;
}
// If no audio RAW frame, or not parsed for no sequence header, drop the packet.
if (format->audio->nb_samples == 0) {
srs_warn("RTC: Drop AAC %d bytes for no sample", shared_audio->size);
return err;
}
if (format->audio->nb_samples != 1) {
return srs_error_new(ERROR_RTC_RTP_MUXER, "adts");
return srs_error_new(ERROR_RTC_RTP_MUXER, "adts samples=%d", format->audio->nb_samples);
}
int nb_buf = format->audio->samples[0].size + 7;

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 74
#define VERSION_REVISION 75
#endif

View file

@ -268,7 +268,7 @@
XX(ERROR_HTTP_WITH_BODY , 3097, "HttpWithBody", "Failed for HTTP body")
/**************************************************/
/* HTTP/StreamCaster protocol error. */
/* HTTP/StreamConverter protocol error. */
#define SRS_ERRNO_MAP_HTTP(XX) \
XX(ERROR_HTTP_PATTERN_EMPTY , 4000, "HttpPatternEmpty", "Failed to handle HTTP request for no pattern") \
XX(ERROR_HTTP_PATTERN_DUPLICATED , 4001, "HttpPatternDuplicated", "Failed to handle HTTP request for pattern duplicated") \

View file

@ -2766,7 +2766,7 @@ VOID TEST(ConfigMainTest, CheckGlobalConfig)
}
}
VOID TEST(ConfigMainTest, CheckStreamCaster)
VOID TEST(ConfigMainTest, CheckStreamConverter)
{
srs_error_t err;