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

Side by Side Diff: webrtc/call/rtx_receive_stream.cc

Issue 3006063002: Reland of Use RtxReceiveStream. (Closed)
Patch Set: Merge remote-tracking branch 'origin/master' into use-RtxStreamReceiver-reland Created 3 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <utility> 11 #include <utility>
12 12
13 #include "webrtc/call/rtx_receive_stream.h" 13 #include "webrtc/call/rtx_receive_stream.h"
14 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
14 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 15 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
15 #include "webrtc/rtc_base/logging.h" 16 #include "webrtc/rtc_base/logging.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 19
19 RtxReceiveStream::RtxReceiveStream(RtpPacketSinkInterface* media_sink, 20 RtxReceiveStream::RtxReceiveStream(
20 std::map<int, int> associated_payload_types, 21 RtpPacketSinkInterface* media_sink,
21 uint32_t media_ssrc) 22 std::map<int, int> associated_payload_types,
23 uint32_t media_ssrc,
24 ReceiveStatistics* rtp_receive_statistics /* = nullptr */)
22 : media_sink_(media_sink), 25 : media_sink_(media_sink),
23 associated_payload_types_(std::move(associated_payload_types)), 26 associated_payload_types_(std::move(associated_payload_types)),
24 media_ssrc_(media_ssrc) { 27 media_ssrc_(media_ssrc),
28 rtp_receive_statistics_(rtp_receive_statistics) {
25 if (associated_payload_types_.empty()) { 29 if (associated_payload_types_.empty()) {
26 LOG(LS_WARNING) 30 LOG(LS_WARNING)
27 << "RtxReceiveStream created with empty payload type mapping."; 31 << "RtxReceiveStream created with empty payload type mapping.";
28 } 32 }
29 } 33 }
30 34
31 RtxReceiveStream::~RtxReceiveStream() = default; 35 RtxReceiveStream::~RtxReceiveStream() = default;
32 36
33 void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) { 37 void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) {
38 if (rtp_receive_statistics_) {
39 RTPHeader header;
40 rtx_packet.GetHeader(&header);
41 // RTX packets are never retransmitted.
42 const bool kNotRetransmitted = false;
danilchap 2017/09/06 10:29:52 to avoid confusion about double negation (not retr
nisse-webrtc 2017/09/06 11:25:10 I'm following the first suggestion. (The kNotRetra
43 rtp_receive_statistics_->IncomingPacket(header, rtx_packet.size(),
44 kNotRetransmitted);
45 }
34 rtc::ArrayView<const uint8_t> payload = rtx_packet.payload(); 46 rtc::ArrayView<const uint8_t> payload = rtx_packet.payload();
35 47
36 if (payload.size() < kRtxHeaderSize) { 48 if (payload.size() < kRtxHeaderSize) {
37 return; 49 return;
38 } 50 }
39 51
40 auto it = associated_payload_types_.find(rtx_packet.PayloadType()); 52 auto it = associated_payload_types_.find(rtx_packet.PayloadType());
41 if (it == associated_payload_types_.end()) { 53 if (it == associated_payload_types_.end()) {
42 LOG(LS_VERBOSE) << "Unknown payload type " 54 LOG(LS_VERBOSE) << "Unknown payload type "
43 << static_cast<int>(rtx_packet.PayloadType()) 55 << static_cast<int>(rtx_packet.PayloadType())
(...skipping 14 matching lines...) Expand all
58 70
59 uint8_t* media_payload = media_packet.AllocatePayload(rtx_payload.size()); 71 uint8_t* media_payload = media_packet.AllocatePayload(rtx_payload.size());
60 RTC_DCHECK(media_payload != nullptr); 72 RTC_DCHECK(media_payload != nullptr);
61 73
62 memcpy(media_payload, rtx_payload.data(), rtx_payload.size()); 74 memcpy(media_payload, rtx_payload.data(), rtx_payload.size());
63 75
64 media_sink_->OnRtpPacket(media_packet); 76 media_sink_->OnRtpPacket(media_packet);
65 } 77 }
66 78
67 } // namespace webrtc 79 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698