mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTSP: Support video only.
This commit is contained in:
parent
f13a1b8ac0
commit
32c5b6fbce
1 changed files with 54 additions and 44 deletions
|
@ -121,8 +121,10 @@ srs_error_t SrsRtpConn::on_udp_packet(const sockaddr* from, const int fromlen, c
|
||||||
// always free it.
|
// always free it.
|
||||||
SrsAutoFree(SrsRtpPacket, cache);
|
SrsAutoFree(SrsRtpPacket, cache);
|
||||||
|
|
||||||
if ((err = rtsp->on_rtp_packet(cache, stream_id)) != srs_success) {
|
err = rtsp->on_rtp_packet(cache, stream_id);
|
||||||
return srs_error_wrap(err, "process rtp packet");
|
if (err != srs_success) {
|
||||||
|
srs_warn("ignore RTP packet err %s", srs_error_desc(err).c_str());
|
||||||
|
srs_freep(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -495,7 +497,11 @@ srs_error_t SrsRtspConn::write_sequence_header()
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate audio sh by audio specific config.
|
// generate audio sh by audio specific config.
|
||||||
if (true) {
|
if (aac_specific_config.empty()) {
|
||||||
|
srs_warn("no audio asc");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
std::string sh = aac_specific_config;
|
std::string sh = aac_specific_config;
|
||||||
|
|
||||||
SrsFormat* format = new SrsFormat();
|
SrsFormat* format = new SrsFormat();
|
||||||
|
@ -535,7 +541,6 @@ srs_error_t SrsRtspConn::write_sequence_header()
|
||||||
if ((err = write_audio_raw_frame((char*)sh.data(), (int)sh.length(), acodec, (uint32_t)dts)) != srs_success) {
|
if ((err = write_audio_raw_frame((char*)sh.data(), (int)sh.length(), acodec, (uint32_t)dts)) != srs_success) {
|
||||||
return srs_error_wrap(err, "write audio raw frame");
|
return srs_error_wrap(err, "write audio raw frame");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -544,6 +549,11 @@ srs_error_t SrsRtspConn::write_h264_sps_pps(uint32_t dts, uint32_t pts)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
if (h264_sps.empty() || h264_pps.empty()) {
|
||||||
|
srs_warn("no sps=%dB or pps=%dB", (int)h264_sps.size(), (int)h264_pps.size());
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
// h264 raw to h264 packet.
|
// h264 raw to h264 packet.
|
||||||
std::string sh;
|
std::string sh;
|
||||||
if ((err = avc->mux_sequence_header(h264_sps, h264_pps, dts, pts, sh)) != srs_success) {
|
if ((err = avc->mux_sequence_header(h264_sps, h264_pps, dts, pts, sh)) != srs_success) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue