| Index: webrtc/call/rtx_receive_stream.cc
|
| diff --git a/webrtc/call/rtx_receive_stream.cc b/webrtc/call/rtx_receive_stream.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..286f867faa8985f6bf5013098ee4041c9f23e8ea
|
| --- /dev/null
|
| +++ b/webrtc/call/rtx_receive_stream.cc
|
| @@ -0,0 +1,56 @@
|
| +/*
|
| + * Copyright (c) 2017 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 <utility>
|
| +
|
| +#include "webrtc/call/rtx_receive_stream.h"
|
| +#include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
|
| +
|
| +namespace webrtc {
|
| +
|
| +RtxReceiveStream::RtxReceiveStream(
|
| + RtpPacketSinkInterface* media_sink,
|
| + std::map<int, int> rtx_payload_type_map,
|
| + uint32_t media_ssrc)
|
| + : media_sink_(media_sink),
|
| + rtx_payload_type_map_(std::move(rtx_payload_type_map)),
|
| + media_ssrc_(media_ssrc) {}
|
| +
|
| +void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) {
|
| + rtc::ArrayView<const uint8_t> payload = rtx_packet.payload();
|
| +
|
| + if (payload.size() < kRtxHeaderSize) {
|
| + return;
|
| + }
|
| +
|
| + auto it = rtx_payload_type_map_.find(rtx_packet.PayloadType());
|
| + if (it == rtx_payload_type_map_.end()) {
|
| + return;
|
| + }
|
| + RtpPacketReceived media_packet;
|
| + media_packet.CopyHeaderFrom(rtx_packet);
|
| +
|
| + media_packet.SetSsrc(media_ssrc_);
|
| + media_packet.SetSequenceNumber((payload[0] << 8) + payload[1]);
|
| + media_packet.SetPayloadType(it->second);
|
| +
|
| + // Skip the RTX header.
|
| + rtc::ArrayView<const uint8_t> rtx_payload =
|
| + payload.subview(kRtxHeaderSize);
|
| +
|
| + uint8_t* media_payload = media_packet.AllocatePayload(rtx_payload.size());
|
| + RTC_DCHECK(media_payload != nullptr);
|
| +
|
| + memcpy(media_payload, rtx_payload.data(), rtx_payload.size());
|
| +
|
| + media_sink_->OnRtpPacket(media_packet);
|
| +}
|
| +
|
| +} // namespace webrtc
|
|
|