| 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) << ":"
|
|
|