OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "webrtc/call/rtx_receive_stream.h" | |
12 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | |
13 | |
14 namespace webrtc { | |
15 | |
16 RtxReceiveStream::RtxReceiveStream( | |
17 RtpPacketSinkInterface* media_sink, | |
18 const std::map<int, int>& rtx_payload_type_map, | |
danilchap
2017/05/17 12:13:05
may be pass by value and move when settings - migh
nisse-webrtc
2017/05/17 13:19:34
Done. A bit counter-intuitive, though. Typical cas
danilchap
2017/05/17 13:43:56
std::move probably is counter-intuitive [that is i
| |
19 uint32_t media_ssrc) | |
20 : media_sink_(media_sink), | |
21 rtx_payload_type_map_(rtx_payload_type_map), | |
22 media_ssrc_(media_ssrc) {} | |
23 | |
24 void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) { | |
25 rtc::ArrayView<const uint8_t> payload = rtx_packet.payload(); | |
26 | |
27 if (payload.size() < kRtxHeaderSize) { | |
28 return; | |
danilchap
2017/05/17 12:13:05
may be add a comment why drop packets silently (Th
nisse-webrtc
2017/05/17 13:19:34
I could add a comment, but I find no guidance in R
danilchap
2017/05/17 13:43:56
Sorry, can't find it either, probably I mixed it u
| |
29 } | |
30 | |
31 auto it = rtx_payload_type_map_.find(rtx_packet.PayloadType()); | |
32 if (it == rtx_payload_type_map_.end()) { | |
33 return; | |
34 } | |
35 RtpPacketReceived media_packet; | |
36 media_packet.CopyHeaderFrom(rtx_packet); | |
danilchap
2017/05/17 12:13:05
This is good: CopyHeaderFrom copies all extensions
nisse-webrtc
2017/05/17 13:19:34
Including the result of IdentifyExtensions?
danilchap
2017/05/17 13:43:55
yes.
(You can verify that with a test)
nisse-webrtc
2017/05/19 07:43:44
I've added a few tests, but extensions still missi
| |
37 | |
38 media_packet.SetSsrc(media_ssrc_); | |
39 media_packet.SetSequenceNumber((payload[0] << 8) + payload[1]); | |
danilchap
2017/05/17 12:13:05
uint8_t + uint8_t will give you uint8_t, not uint1
nisse-webrtc
2017/05/17 13:19:34
Are you sure? Check the section on integer promoti
danilchap
2017/05/17 13:43:56
You right, I'm not sure. guess current code good a
| |
40 media_packet.SetPayloadType(it->second); | |
41 | |
danilchap
2017/05/17 12:13:05
may be add
payload = payload.subview(kRtxHeaderSiz
nisse-webrtc
2017/05/17 13:19:34
Done, but with a new variable |rtx_payload|.
danilchap
2017/05/17 13:43:55
That is even better!
| |
42 uint8_t* media_payload = | |
43 media_packet.AllocatePayload(payload.size() - kRtxHeaderSize); | |
44 if (!media_payload) { | |
45 return; | |
danilchap
2017/05/17 12:13:05
may be RTC_DCHECK or LOG(LS_ERROR):
This might ha
nisse-webrtc
2017/05/17 13:19:35
Done.
| |
46 } | |
47 memcpy(media_payload, payload.data() + kRtxHeaderSize, | |
48 payload.size() - kRtxHeaderSize); | |
49 | |
50 media_sink_->OnRtpPacket(media_packet); | |
51 } | |
52 | |
53 } // namespace webrtc | |
OLD | NEW |