Bug 1389256 - fix incomplete handling of RepairedRtpStreamId after webrtc.org backport of RtpStreamId. r=bwc
authorMichael Froman <mfroman@mozilla.com>
Fri, 28 Jul 2017 14:52:46 -0500
changeset 374289 aec707871c363db6b248f3a250d2c1e401b6814c
parent 374288 40d6dab9de6d0580937d23aba1d821c9148daf71
child 374290 6f71999ab3493cc14ac1d850c0ceda9eb24b2c2d
push id32320
push userarchaeopteryx@coole-files.de
push dateSat, 12 Aug 2017 21:35:10 +0000
treeherdermozilla-central@6062341662fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1389256
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1389256 - fix incomplete handling of RepairedRtpStreamId after webrtc.org backport of RtpStreamId. r=bwc During my backport of RtpStreamId from webrtc.org, I missed a few places where RepairedRtpStreamId was used or was not completely implemented. Also, the webrtc.org code used repairedStreamId, which is not really correct per the spec (draft-ietf-avtext-rid) so I fixed all occurances to use the correct repairedRtpStreamId to avoid confusion later. The RTP header extensions default IDs for RtpStreamId and RepairedRtpStreamId were also adjusted to not collide with PlayoutDelay's default ID. MozReview-Commit-ID: HSlS8nsKQ29
media/webrtc/trunk/webrtc/common_types.cc
media/webrtc/trunk/webrtc/common_types.h
media/webrtc/trunk/webrtc/config.cc
media/webrtc/trunk/webrtc/config.h
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility_unittest.cc
media/webrtc/trunk/webrtc/video/rtp_stream_receiver.cc
--- a/media/webrtc/trunk/webrtc/common_types.cc
+++ b/media/webrtc/trunk/webrtc/common_types.cc
@@ -69,16 +69,17 @@ RTPHeaderExtension::operator=(const RTPH
   hasAudioLevel = rhs.hasAudioLevel;
   voiceActivity = rhs.voiceActivity;
   audioLevel = rhs.audioLevel;
 
   hasVideoRotation = rhs.hasVideoRotation;
   videoRotation = rhs.videoRotation;
 
   rtpStreamId = rhs.rtpStreamId;
+  repairedRtpStreamId = rhs.repairedRtpStreamId;
 
   return *this;
 }
 
 RTPHeader::RTPHeader()
     : markerBit(false),
       payloadType(0),
       sequenceNumber(0),
--- a/media/webrtc/trunk/webrtc/common_types.h
+++ b/media/webrtc/trunk/webrtc/common_types.h
@@ -814,19 +814,19 @@ struct PacketTime {
 //
 // Note: Given that this gets embedded in a union, it is up-to the owner to
 // initialize these values.
 struct PlayoutDelay {
   int min_ms;
   int max_ms;
 };
 
-// Class to represent RtpStreamId which is a string.
+// Class to represent RtpStreamId and RepairedRtpStreamId which is a string.
 // Unlike std::string, it can be copied with memcpy and cleared with memset.
-// Empty value represent unset RtpStreamId.
+// Empty value represent unset stream id.
 class StreamId {
  public:
   // Stream id is limited to 16 bytes because it is the maximum length
   // that can be encoded with one-byte header extensions.
   static constexpr size_t kMaxSize = 16;
 
   static bool IsLegalName(rtc::ArrayView<const char> name);
 
@@ -884,17 +884,17 @@ struct RTPHeaderExtension {
   VideoRotation videoRotation;
 
   PlayoutDelay playout_delay = {-1, -1};
 
   // For identification of a stream when ssrc is not signaled. See
   // https://tools.ietf.org/html/draft-ietf-avtext-rid-09
   // TODO(danilchap): Update url from draft to release version.
   StreamId rtpStreamId;
-  StreamId repairedStreamId;
+  StreamId repairedRtpStreamId;
 };
 
 struct RTPHeader {
   RTPHeader();
 
   bool markerBit;
   uint8_t payloadType;
   uint16_t sequenceNumber;
--- a/media/webrtc/trunk/webrtc/config.cc
+++ b/media/webrtc/trunk/webrtc/config.cc
@@ -59,41 +59,47 @@ const int RtpExtension::kAbsSendTimeDefa
 
 const char* RtpExtension::kVideoRotationUri = "urn:3gpp:video-orientation";
 const int RtpExtension::kVideoRotationDefaultId = 4;
 
 const char* RtpExtension::kTransportSequenceNumberUri =
     "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
 const int RtpExtension::kTransportSequenceNumberDefaultId = 5;
 
-const char* RtpExtension::kRtpStreamIdUri =
-  "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id";
-const int RtpExtension::kRtpStreamIdDefaultId = 6;
-
 // This extension allows applications to adaptively limit the playout delay
 // on frames as per the current needs. For example, a gaming application
 // has very different needs on end-to-end delay compared to a video-conference
 // application.
 const char* RtpExtension::kPlayoutDelayUri =
     "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
 const int RtpExtension::kPlayoutDelayDefaultId = 6;
 
+const char* RtpExtension::kRtpStreamIdUri =
+    "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id";
+const int RtpExtension::kRtpStreamIdDefaultId = 7;
+
+const char* RtpExtension::kRepairedRtpStreamIdUri =
+    "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id";
+const int RtpExtension::kRepairedRtpStreamIdDefaultId = 8;
+
 bool RtpExtension::IsSupportedForAudio(const std::string& uri) {
   return uri == webrtc::RtpExtension::kAudioLevelUri ||
          uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
-         uri == webrtc::RtpExtension::kRtpStreamIdUri;
+         uri == webrtc::RtpExtension::kRtpStreamIdUri ||
+         uri == webrtc::RtpExtension::kRepairedRtpStreamIdUri;
 }
 
 bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
   return uri == webrtc::RtpExtension::kTimestampOffsetUri ||
          uri == webrtc::RtpExtension::kAbsSendTimeUri ||
          uri == webrtc::RtpExtension::kVideoRotationUri ||
          uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
          uri == webrtc::RtpExtension::kPlayoutDelayUri ||
-         uri == webrtc::RtpExtension::kRtpStreamIdUri;
+         uri == webrtc::RtpExtension::kRtpStreamIdUri ||
+         uri == webrtc::RtpExtension::kRepairedRtpStreamIdUri;
 }
 
 VideoStream::VideoStream()
     : width(0),
       height(0),
       max_framerate(-1),
       min_bitrate_bps(-1),
       target_bitrate_bps(-1),
--- a/media/webrtc/trunk/webrtc/config.h
+++ b/media/webrtc/trunk/webrtc/config.h
@@ -96,16 +96,19 @@ struct RtpExtension {
   static const int kTransportSequenceNumberDefaultId;
 
   static const char* kPlayoutDelayUri;
   static const int kPlayoutDelayDefaultId;
 
   static const char* kRtpStreamIdUri;
   static const int kRtpStreamIdDefaultId;
 
+  static const char* kRepairedRtpStreamIdUri;
+  static const int kRepairedRtpStreamIdDefaultId;
+
   std::string uri;
   int id;
 };
 
 struct VideoStream {
   VideoStream();
   ~VideoStream();
   std::string ToString() const;
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
@@ -167,17 +167,17 @@ void Packet::GetHeader(RTPHeader* header
   header->extension.hasTransportSequenceNumber =
       GetExtension<TransportSequenceNumber>(
           &header->extension.transportSequenceNumber);
   header->extension.hasAudioLevel = GetExtension<AudioLevel>(
       &header->extension.voiceActivity, &header->extension.audioLevel);
   header->extension.hasVideoRotation =
       GetExtension<VideoOrientation>(&header->extension.videoRotation);
   GetExtension<RtpStreamId>(&header->extension.rtpStreamId);
-  GetExtension<RepairedRtpStreamId>(&header->extension.repairedStreamId);
+  GetExtension<RepairedRtpStreamId>(&header->extension.repairedRtpStreamId);
   GetExtension<PlayoutDelayLimits>(&header->extension.playout_delay);
 }
 
 size_t Packet::headers_size() const {
   return payload_offset_;
 }
 
 size_t Packet::payload_size() const {
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -38,16 +38,18 @@ RTPExtensionType StringToRtpExtensionTyp
   if (extension == RtpExtension::kVideoRotationUri)
     return kRtpExtensionVideoRotation;
   if (extension == RtpExtension::kTransportSequenceNumberUri)
     return kRtpExtensionTransportSequenceNumber;
   if (extension == RtpExtension::kPlayoutDelayUri)
     return kRtpExtensionPlayoutDelay;
   if (extension == RtpExtension::kRtpStreamIdUri)
     return kRtpExtensionRtpStreamId;
+  if (extension == RtpExtension::kRepairedRtpStreamIdUri)
+    return kRtpExtensionRepairedRtpStreamId;
   RTC_NOTREACHED() << "Looking up unsupported RTP extension.";
   return kRtpExtensionNone;
 }
 
 RtpRtcp::Configuration::Configuration()
     : receive_statistics(NullObjectReceiveStatistics()) {}
 
 RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
@@ -456,17 +456,17 @@ void RtpHeaderParser::ParseOneByteExtens
               max_playout_delay * kPlayoutDelayGranularityMs;
           break;
         }
         case kRtpExtensionRtpStreamId: {
           header->extension.rtpStreamId.Set(rtc::MakeArrayView(ptr, len + 1));
           break;
         }
         case kRtpExtensionRepairedRtpStreamId: {
-          header->extension.repairedStreamId.Set(
+          header->extension.repairedRtpStreamId.Set(
               rtc::MakeArrayView(ptr, len + 1));
           break;
         }
         default:
         case kRtpExtensionNone:
         case kRtpExtensionNumberOfExtensions: {
           RTC_NOTREACHED() << "Invalid extension type: " << type;
           return;
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility_unittest.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility_unittest.cc
@@ -199,17 +199,17 @@ TEST(RtpHeaderParser, ParseAll8Extension
   EXPECT_TRUE(header.extension.hasVideoRotation);
   EXPECT_EQ(kVideoRotation_270, header.extension.videoRotation);
 
   EXPECT_EQ(0x124 * PlayoutDelayLimits::kGranularityMs,
             header.extension.playout_delay.min_ms);
   EXPECT_EQ(0x876 * PlayoutDelayLimits::kGranularityMs,
             header.extension.playout_delay.max_ms);
   EXPECT_EQ(header.extension.rtpStreamId, StreamId("rtx"));
-  EXPECT_EQ(header.extension.repairedStreamId, StreamId("stream"));
+  EXPECT_EQ(header.extension.repairedRtpStreamId, StreamId("stream"));
 }
 
 TEST(RtpHeaderParser, ParseMalformedRsidExtensions) {
   // clang-format off
   const uint8_t kPacket[] = {
       0x90, kPayloadType, 0x00, kSeqNum,
       0x65, 0x43, 0x12, 0x78,  // kTimestamp.
       0x12, 0x34, 0x56, 0x78,  // kSsrc.
@@ -224,17 +224,17 @@ TEST(RtpHeaderParser, ParseMalformedRsid
   RtpHeaderExtensionMap extensions;
   extensions.Register<RtpStreamId>(0xc);
   extensions.Register<RepairedRtpStreamId>(0xd);
   RtpUtility::RtpHeaderParser parser(kPacket, sizeof(kPacket));
   RTPHeader header;
 
   EXPECT_TRUE(parser.Parse(&header, &extensions));
   EXPECT_TRUE(header.extension.rtpStreamId.empty());
-  EXPECT_EQ(header.extension.repairedStreamId, StreamId("str"));
+  EXPECT_EQ(header.extension.repairedRtpStreamId, StreamId("str"));
 }
 
 TEST(RtpHeaderParser, ParseWithCsrcsExtensionAndPadding) {
   const uint8_t kPacketPaddingSize = 8;
   const uint32_t kCsrcs[] = {0x34567890, 0x32435465};
   const size_t kPayloadSize = 7;
   // clang-format off
   const uint8_t kPacket[] = {
--- a/media/webrtc/trunk/webrtc/video/rtp_stream_receiver.cc
+++ b/media/webrtc/trunk/webrtc/video/rtp_stream_receiver.cc
@@ -387,16 +387,18 @@ bool RtpStreamReceiver::DeliverRtp(const
          << header.timestamp << ", sequence number: " << header.sequenceNumber
          << ", arrival time: " << arrival_time_ms;
       if (header.extension.hasTransmissionTimeOffset)
         ss << ", toffset: " << header.extension.transmissionTimeOffset;
       if (header.extension.hasAbsoluteSendTime)
         ss << ", abs send time: " << header.extension.absoluteSendTime;
       if (!header.extension.rtpStreamId.empty())
         ss << ", rid: " << header.extension.rtpStreamId.data();
+      if (!header.extension.repairedRtpStreamId.empty())
+        ss << ", repaired rid: " << header.extension.repairedRtpStreamId.data();
       LOG(LS_INFO) << ss.str();
       last_packet_log_ms_ = now_ms;
     }
   }
 
   remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_length,
                                             header);
   header.payload_type_frequency = kVideoPayloadTypeFrequency;