Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: media/cast/transport/rtp_sender/rtp_sender.cc

Issue 252923007: Cast: Fix two video freezing problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/transport/rtp_sender/rtp_sender.h ('k') | media/cast/transport/transport/udp_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/transport/rtp_sender/rtp_sender.cc
diff --git a/media/cast/transport/rtp_sender/rtp_sender.cc b/media/cast/transport/rtp_sender/rtp_sender.cc
index 41bb97e1511ab1a639deb0888613f65e2b6c8112..6c479bb46b77a1c14101d357473dc2c792a05890 100644
--- a/media/cast/transport/rtp_sender/rtp_sender.cc
+++ b/media/cast/transport/rtp_sender/rtp_sender.cc
@@ -33,26 +33,32 @@ RtpSender::RtpSender(
RtpSender::~RtpSender() {}
-void RtpSender::InitializeAudio(const CastTransportAudioConfig& config) {
- storage_.reset(new PacketStorage(clock_, config.base.rtp_config.history_ms));
+bool RtpSender::InitializeAudio(const CastTransportAudioConfig& config) {
+ storage_.reset(new PacketStorage(config.rtp.max_outstanding_frames));
+ if (!storage_->IsValid()) {
+ return false;
+ }
config_.audio = true;
- config_.ssrc = config.base.ssrc;
- config_.payload_type = config.base.rtp_config.payload_type;
+ config_.ssrc = config.rtp.config.ssrc;
+ config_.payload_type = config.rtp.config.payload_type;
config_.frequency = config.frequency;
config_.audio_codec = config.codec;
- packetizer_.reset(
- new RtpPacketizer(transport_, storage_.get(), config_));
+ packetizer_.reset(new RtpPacketizer(transport_, storage_.get(), config_));
+ return true;
}
-void RtpSender::InitializeVideo(const CastTransportVideoConfig& config) {
- storage_.reset(new PacketStorage(clock_, config.base.rtp_config.history_ms));
+bool RtpSender::InitializeVideo(const CastTransportVideoConfig& config) {
+ storage_.reset(new PacketStorage(config.rtp.max_outstanding_frames));
+ if (!storage_->IsValid()) {
+ return false;
+ }
config_.audio = false;
- config_.ssrc = config.base.ssrc;
- config_.payload_type = config.base.rtp_config.payload_type;
+ config_.ssrc = config.rtp.config.ssrc;
+ config_.payload_type = config.rtp.config.payload_type;
config_.frequency = kVideoFrequency;
config_.video_codec = config.codec;
- packetizer_.reset(
- new RtpPacketizer(transport_, storage_.get(), config_));
+ packetizer_.reset(new RtpPacketizer(transport_, storage_.get(), config_));
+ return true;
}
void RtpSender::IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame,
@@ -89,6 +95,10 @@ void RtpSender::ResendPackets(
// Get packet from storage.
success = storage_->GetPacket(frame_id, packet_id, &packets_to_resend);
+ // Check that we got at least one packet.
+ DCHECK(packet_id != 0 || success)
+ << "Failed to resend frame " << static_cast<int>(frame_id);
+
// Resend packet to the network.
if (success) {
VLOG(3) << "Resend " << static_cast<int>(frame_id) << ":"
@@ -108,6 +118,10 @@ void RtpSender::ResendPackets(
uint16 packet_id = *set_it;
success = storage_->GetPacket(frame_id, packet_id, &packets_to_resend);
+ // Check that we got at least one packet.
+ DCHECK(set_it != packets_set.begin() || success)
+ << "Failed to resend frame " << frame_id;
+
// Resend packet to the network.
if (success) {
VLOG(3) << "Resend " << static_cast<int>(frame_id) << ":"
« no previous file with comments | « media/cast/transport/rtp_sender/rtp_sender.h ('k') | media/cast/transport/transport/udp_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698