mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
Refactor RTC publish queue
This commit is contained in:
parent
8c4b6d3166
commit
42ae71e96c
1 changed files with 44 additions and 40 deletions
|
@ -384,18 +384,18 @@ void SrsRtpAudioQueue::collect_frames(SrsRtpNackForReceiver* nack, vector<SrsRtp
|
|||
{
|
||||
// When done, next point to the next available packet.
|
||||
uint16_t next = queue_->begin;
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
|
||||
// If nack disabled, we ignore any empty packet.
|
||||
if (!nack) {
|
||||
if (!pkt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
if (pkt) {
|
||||
frames.push_back(pkt);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
|
||||
// TODO: FIXME: Should not wait for NACK packets.
|
||||
// Not found or in NACK, stop collecting frame.
|
||||
|
@ -406,7 +406,9 @@ void SrsRtpAudioQueue::collect_frames(SrsRtpNackForReceiver* nack, vector<SrsRtp
|
|||
|
||||
frames.push_back(pkt);
|
||||
}
|
||||
}
|
||||
|
||||
// Reap packets from begin to next.
|
||||
if (next != queue_->begin) {
|
||||
// Reset the range of packets to NULL in buffer.
|
||||
queue_->reset(queue_->begin, next);
|
||||
|
@ -540,12 +542,11 @@ void SrsRtpVideoQueue::collect_frame(SrsRtpNackForReceiver* nack, SrsRtpPacket2*
|
|||
|
||||
// When done, next point to the next available packet.
|
||||
uint16_t next = queue_->begin;
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
|
||||
// TODO: FIXME: We should skip whole packet.
|
||||
// If nack disabled, we ignore any empty packet.
|
||||
if (!nack) {
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
if (!pkt) {
|
||||
continue;
|
||||
}
|
||||
|
@ -561,8 +562,10 @@ void SrsRtpVideoQueue::collect_frame(SrsRtpNackForReceiver* nack, SrsRtpPacket2*
|
|||
next++;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
for (; next != queue_->end; ++next) {
|
||||
SrsRtpPacket2* pkt = queue_->at(next);
|
||||
|
||||
// TODO: FIXME: Should not wait for NACK packets.
|
||||
// Not found or in NACK, stop collecting frame.
|
||||
|
@ -587,6 +590,7 @@ void SrsRtpVideoQueue::collect_frame(SrsRtpNackForReceiver* nack, SrsRtpPacket2*
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found || frame.empty()) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue