提交 00c61558 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

works fine

上级 d882dc28
...@@ -22,7 +22,8 @@ namespace RTC ...@@ -22,7 +22,8 @@ namespace RTC
RtpStreamSend::RtpStreamSend( RtpStreamSend::RtpStreamSend(
RTC::RtpStreamSend::Listener* listener, RTC::RtpStream::Params& params, size_t bufferSize) RTC::RtpStreamSend::Listener* listener, RTC::RtpStream::Params& params, size_t bufferSize)
: RTC::RtpStream::RtpStream(listener, params, 10), buffer(bufferSize > 0 ? 65536 : 0), storage(bufferSize) : RTC::RtpStream::RtpStream(listener, params, 10), buffer(bufferSize > 0 ? 65536 : 0),
storage(bufferSize)
{ {
MS_TRACE(); MS_TRACE();
} }
...@@ -98,8 +99,6 @@ namespace RTC ...@@ -98,8 +99,6 @@ namespace RTC
// (FillRetransmissionContainer() did it). // (FillRetransmissionContainer() did it).
auto* packet = bufferItem->packet; auto* packet = bufferItem->packet;
MS_ERROR("----- RETRANSMITTING PACKET seq:%" PRIu16, packet->GetSequenceNumber());
// Retransmit the packet. // Retransmit the packet.
static_cast<RTC::RtpStreamSend::Listener*>(this->listener) static_cast<RTC::RtpStreamSend::Listener*>(this->listener)
->OnRtpStreamRetransmitRtpPacket(this, packet); ->OnRtpStreamRetransmitRtpPacket(this, packet);
...@@ -240,8 +239,6 @@ namespace RTC ...@@ -240,8 +239,6 @@ namespace RTC
if (bufferItem.packet) if (bufferItem.packet)
{ {
MS_ERROR("new bufferStartIdx: %" PRIu16, seq);
this->bufferStartIdx = seq; this->bufferStartIdx = seq;
break; break;
...@@ -268,8 +265,6 @@ namespace RTC ...@@ -268,8 +265,6 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
MS_ERROR("--begin-- seq:%" PRIu16, packet->GetSequenceNumber());
if (packet->GetSize() > RTC::MtuSize) if (packet->GetSize() > RTC::MtuSize)
{ {
MS_WARN_TAG( MS_WARN_TAG(
...@@ -289,8 +284,6 @@ namespace RTC ...@@ -289,8 +284,6 @@ namespace RTC
// Buffer is empty. // Buffer is empty.
if (this->bufferSize == 0) if (this->bufferSize == 0)
{ {
MS_ERROR("--1-- seq:%" PRIu16 ", buffer empty, first item", packet->GetSequenceNumber());
// Take the first storage position. // Take the first storage position.
store = this->storage[0].store; store = this->storage[0].store;
...@@ -301,16 +294,8 @@ namespace RTC ...@@ -301,16 +294,8 @@ namespace RTC
// the new packet or just ignore it (if duplicated packet). // the new packet or just ignore it (if duplicated packet).
else if (bufferItem.packet) else if (bufferItem.packet)
{ {
MS_ERROR("--2-- seq:%" PRIu16 ", bufferItem used", packet->GetSequenceNumber());
if (packet->GetTimestamp() == bufferItem.packet->GetTimestamp()) if (packet->GetTimestamp() == bufferItem.packet->GetTimestamp())
{
MS_ERROR("--2.1-- seq:%" PRIu16 ", duplicated packet, ignore", packet->GetSequenceNumber());
return; return;
}
MS_ERROR("--2.2-- seq:%" PRIu16 ", replacing stored packet", packet->GetSequenceNumber());
// Reuse the store used by the buffer item. // Reuse the store used by the buffer item.
store = const_cast<uint8_t*>(bufferItem.packet->GetData()); store = const_cast<uint8_t*>(bufferItem.packet->GetData());
...@@ -326,8 +311,6 @@ namespace RTC ...@@ -326,8 +311,6 @@ namespace RTC
// Buffer not yet full, add an entry. // Buffer not yet full, add an entry.
else if (this->bufferSize < this->storage.size()) else if (this->bufferSize < this->storage.size())
{ {
MS_ERROR("--3-- seq:%" PRIu16 ", buffer not full yet", packet->GetSequenceNumber());
// Take the next storage position. // Take the next storage position.
store = this->storage[this->bufferSize].store; store = this->storage[this->bufferSize].store;
...@@ -336,8 +319,6 @@ namespace RTC ...@@ -336,8 +319,6 @@ namespace RTC
// Buffer full, remove oldest entry and add new one. // Buffer full, remove oldest entry and add new one.
else else
{ {
MS_ERROR("--4-- seq:%" PRIu16 ", buffer full, removing oldest entry", packet->GetSequenceNumber());
auto& firstBufferItem = this->buffer[this->bufferStartIdx]; auto& firstBufferItem = this->buffer[this->bufferStartIdx];
// Reuse the store used by the first buffer item. // Reuse the store used by the first buffer item.
...@@ -354,23 +335,6 @@ namespace RTC ...@@ -354,23 +335,6 @@ namespace RTC
// corresponding buffer item. // corresponding buffer item.
// Update the new buffer item so it points to the cloned packed. // Update the new buffer item so it points to the cloned packed.
bufferItem.packet = packet->Clone(store); bufferItem.packet = packet->Clone(store);
MS_ERROR("--end-- seq:%" PRIu16, packet->GetSequenceNumber());
// TODO
MS_ERROR(
"<BUFFER DUMP> bufferStartIdx:%" PRIu16 ", bufferSize:%zu",
this->bufferStartIdx, this->bufferSize);
for (size_t seq{ 0 }; seq < this->buffer.size(); ++seq)
{
auto& bufferItem = this->buffer[seq];
if (bufferItem.packet)
MS_ERROR(" - item buffer with packet: seq:%zu", seq);
}
MS_ERROR("</BUFFER DUMP>");
} }
// This method looks for the requested RTP packets and inserts them into the // This method looks for the requested RTP packets and inserts them into the
...@@ -399,7 +363,7 @@ namespace RTC ...@@ -399,7 +363,7 @@ namespace RTC
bool requested{ true }; bool requested{ true };
size_t containerIdx{ 0 }; size_t containerIdx{ 0 };
// Some variables for debugging. // Variables for debugging.
uint16_t origBitmask = bitmask; uint16_t origBitmask = bitmask;
uint16_t sentBitmask{ 0b0000000000000000 }; uint16_t sentBitmask{ 0b0000000000000000 };
bool isFirstPacket{ true }; bool isFirstPacket{ true };
...@@ -469,8 +433,7 @@ namespace RTC ...@@ -469,8 +433,7 @@ namespace RTC
// now. // now.
if (HasRtx() && !bufferItem.rtxEncoded) if (HasRtx() && !bufferItem.rtxEncoded)
{ {
packet->RtxEncode( packet->RtxEncode(this->params.rtxPayloadType, this->params.rtxSsrc, ++this->rtxSeq);
this->params.rtxPayloadType, this->params.rtxSsrc, ++this->rtxSeq);
bufferItem.rtxEncoded = true; bufferItem.rtxEncoded = true;
} }
......
...@@ -94,7 +94,7 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]") ...@@ -94,7 +94,7 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]")
params.useNack = true; params.useNack = true;
// Create a RtpStreamSend. // Create a RtpStreamSend.
RtpStreamSend* stream = new RtpStreamSend(&testRtpStreamListener, params, 5); RtpStreamSend* stream = new RtpStreamSend(&testRtpStreamListener, params, 3);
// Receive all the packets (some of them not in order and/or duplicated). // Receive all the packets (some of them not in order and/or duplicated).
stream->ReceivePacket(packet1); stream->ReceivePacket(packet1);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论