mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Send SPS/PPS before IDR
This commit is contained in:
parent
79d46fa2e1
commit
5e66a0d342
1 changed files with 31 additions and 31 deletions
|
@ -641,15 +641,6 @@ srs_error_t SrsRtcSenderThread::send_messages(
|
|||
*pnn_rtp_pkts += 1;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < msg->nn_samples(); i++) {
|
||||
SrsSample* sample = msg->samples() + i;
|
||||
|
||||
// We always ignore bframe here, if config to discard bframe,
|
||||
// the bframe flag will not be set.
|
||||
if (sample->bframe) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Well, for each IDR, we append a SPS/PPS before it, which is packaged in STAP-A.
|
||||
if (msg->has_idr()) {
|
||||
SrsRtpPacket2* packet = NULL;
|
||||
|
@ -667,6 +658,15 @@ srs_error_t SrsRtcSenderThread::send_messages(
|
|||
}
|
||||
|
||||
vector<SrsRtpPacket2*> packets;
|
||||
for (int i = 0; i < msg->nn_samples(); i++) {
|
||||
SrsSample* sample = msg->samples() + i;
|
||||
|
||||
// We always ignore bframe here, if config to discard bframe,
|
||||
// the bframe flag will not be set.
|
||||
if (sample->bframe) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sample->size <= kRtpMaxPayloadSize) {
|
||||
SrsRtpPacket2* packet = NULL;
|
||||
if ((err = packet_single_nalu(msg, sample, &packet)) != srs_success) {
|
||||
|
@ -678,8 +678,9 @@ srs_error_t SrsRtcSenderThread::send_messages(
|
|||
return srs_error_wrap(err, "packet fu-a");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == msg->nn_samples() - 1) {
|
||||
if (!packets.empty()) {
|
||||
packets.back()->rtp_header.set_marker(true);
|
||||
}
|
||||
|
||||
|
@ -694,7 +695,6 @@ srs_error_t SrsRtcSenderThread::send_messages(
|
|||
*pnn_rtp_pkts += (int)packets.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue