Adds negotiation of rtx codecs for red and vp9. To keep backwards compatibility with older Chrome versions, this change includes two hacks: 1. Red packets will be retransmitted over the rtx codec associated with vp8 if no rtx codec is associated with red. This is how Chrome does it today and ensures that we still can send red over rtx to older versions. 2. If rtx packets associated with the media codec (vp8/vp9 etc) are received and red has been negotiated, we will assume that the sender incorrectly has packetized red inside the rtx header associated with media. We will therefore restore it with the red payload type instead, which ensures that we can still receive rtx associated with red from old versions. Offering multiple rtx codecs to older versions should not be a problem since old versions themselves only try to negotiate rtx for vp8. R=pbos@webrtc.org TBR=mflodman@webrtc.org BUG=webrtc:4024 TEST=Verified by running apprtc and emulating packet loss between Chrome with and without the patch. Review URL: https://codereview.webrtc.org/1649493004 . Cr-Commit-Position: refs/heads/master@{#11472}
124 lines
3.6 KiB
C++
124 lines
3.6 KiB
C++
/*
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#include "webrtc/config.h"
|
|
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
namespace webrtc {
|
|
std::string FecConfig::ToString() const {
|
|
std::stringstream ss;
|
|
ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
|
|
ss << ", red_payload_type: " << red_payload_type;
|
|
ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
|
|
ss << '}';
|
|
return ss.str();
|
|
}
|
|
|
|
std::string RtpExtension::ToString() const {
|
|
std::stringstream ss;
|
|
ss << "{name: " << name;
|
|
ss << ", id: " << id;
|
|
ss << '}';
|
|
return ss.str();
|
|
}
|
|
|
|
const char* RtpExtension::kTOffset = "urn:ietf:params:rtp-hdrext:toffset";
|
|
const char* RtpExtension::kAbsSendTime =
|
|
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
|
|
const char* RtpExtension::kVideoRotation = "urn:3gpp:video-orientation";
|
|
const char* RtpExtension::kAudioLevel =
|
|
"urn:ietf:params:rtp-hdrext:ssrc-audio-level";
|
|
const char* RtpExtension::kTransportSequenceNumber =
|
|
"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions";
|
|
|
|
bool RtpExtension::IsSupportedForAudio(const std::string& name) {
|
|
return name == webrtc::RtpExtension::kAbsSendTime ||
|
|
name == webrtc::RtpExtension::kAudioLevel ||
|
|
name == webrtc::RtpExtension::kTransportSequenceNumber;
|
|
}
|
|
|
|
bool RtpExtension::IsSupportedForVideo(const std::string& name) {
|
|
return name == webrtc::RtpExtension::kTOffset ||
|
|
name == webrtc::RtpExtension::kAbsSendTime ||
|
|
name == webrtc::RtpExtension::kVideoRotation ||
|
|
name == webrtc::RtpExtension::kTransportSequenceNumber;
|
|
}
|
|
|
|
VideoStream::VideoStream()
|
|
: width(0),
|
|
height(0),
|
|
max_framerate(-1),
|
|
min_bitrate_bps(-1),
|
|
target_bitrate_bps(-1),
|
|
max_bitrate_bps(-1),
|
|
max_qp(-1) {}
|
|
|
|
VideoStream::~VideoStream() = default;
|
|
|
|
std::string VideoStream::ToString() const {
|
|
std::stringstream ss;
|
|
ss << "{width: " << width;
|
|
ss << ", height: " << height;
|
|
ss << ", max_framerate: " << max_framerate;
|
|
ss << ", min_bitrate_bps:" << min_bitrate_bps;
|
|
ss << ", target_bitrate_bps:" << target_bitrate_bps;
|
|
ss << ", max_bitrate_bps:" << max_bitrate_bps;
|
|
ss << ", max_qp: " << max_qp;
|
|
|
|
ss << ", temporal_layer_thresholds_bps: [";
|
|
for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) {
|
|
ss << temporal_layer_thresholds_bps[i];
|
|
if (i != temporal_layer_thresholds_bps.size() - 1)
|
|
ss << ", ";
|
|
}
|
|
ss << ']';
|
|
|
|
ss << '}';
|
|
return ss.str();
|
|
}
|
|
|
|
VideoEncoderConfig::VideoEncoderConfig()
|
|
: content_type(ContentType::kRealtimeVideo),
|
|
encoder_specific_settings(NULL),
|
|
min_transmit_bitrate_bps(0) {
|
|
}
|
|
|
|
VideoEncoderConfig::~VideoEncoderConfig() = default;
|
|
|
|
std::string VideoEncoderConfig::ToString() const {
|
|
std::stringstream ss;
|
|
|
|
ss << "{streams: [";
|
|
for (size_t i = 0; i < streams.size(); ++i) {
|
|
ss << streams[i].ToString();
|
|
if (i != streams.size() - 1)
|
|
ss << ", ";
|
|
}
|
|
ss << ']';
|
|
ss << ", content_type: ";
|
|
switch (content_type) {
|
|
case ContentType::kRealtimeVideo:
|
|
ss << "kRealtimeVideo";
|
|
break;
|
|
case ContentType::kScreen:
|
|
ss << "kScreenshare";
|
|
break;
|
|
}
|
|
ss << ", encoder_specific_settings: ";
|
|
ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
|
|
|
|
ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
|
|
ss << '}';
|
|
return ss.str();
|
|
}
|
|
|
|
} // namespace webrtc
|