summaryrefslogtreecommitdiff
path: root/media/cast/pacing/paced_sender.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/cast/pacing/paced_sender.cc')
-rw-r--r--media/cast/pacing/paced_sender.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/media/cast/pacing/paced_sender.cc b/media/cast/pacing/paced_sender.cc
index 4abda9bd0b..af13d3ad71 100644
--- a/media/cast/pacing/paced_sender.cc
+++ b/media/cast/pacing/paced_sender.cc
@@ -28,15 +28,22 @@ PacedSender::PacedSender(scoped_refptr<CastEnvironment> cast_environment,
PacedSender::~PacedSender() {}
bool PacedSender::SendPackets(const PacketList& packets) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
+ cast_environment_->Logging()->InsertPacketListEvent(kPacketSentToPacer,
+ packets);
return SendPacketsToTransport(packets, &packet_list_);
}
bool PacedSender::ResendPackets(const PacketList& packets) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
+ cast_environment_->Logging()->InsertPacketListEvent(kPacketRetransmited,
+ packets);
return SendPacketsToTransport(packets, &resend_packet_list_);
}
bool PacedSender::SendPacketsToTransport(const PacketList& packets,
PacketList* packets_not_sent) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
UpdateBurstSize(packets.size());
if (!packets_not_sent->empty()) {
@@ -61,10 +68,13 @@ bool PacedSender::SendPacketsToTransport(const PacketList& packets,
packets_sent_in_burst_ += packets_to_send.size();
if (packets_to_send.empty()) return true;
+ cast_environment_->Logging()->InsertPacketListEvent(kPacketSentToNetwork,
+ packets);
return transport_->SendPackets(packets_to_send);
}
bool PacedSender::SendRtcpPacket(const Packet& packet) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
// We pass the RTCP packets straight through.
return transport_->SendPacket(packet);
}
@@ -82,12 +92,14 @@ void PacedSender::ScheduleNextSend() {
}
void PacedSender::SendNextPacketBurst() {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
SendStoredPackets();
time_last_process_ = cast_environment_->Clock()->NowTicks();
ScheduleNextSend();
}
void PacedSender::SendStoredPackets() {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
if (packet_list_.empty() && resend_packet_list_.empty()) return;
size_t packets_to_send = burst_size_;
@@ -123,6 +135,7 @@ void PacedSender::SendStoredPackets() {
}
void PacedSender::UpdateBurstSize(size_t packets_to_send) {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
packets_to_send = std::max(packets_to_send,
resend_packet_list_.size() + packet_list_.size());