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

Side by Side Diff: webrtc/test/layer_filtering_transport.cc

Issue 1350383004: Using different sequence numbers for different SSRCs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding a comment Created 5 years, 2 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
« no previous file with comments | « webrtc/test/layer_filtering_transport.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
(...skipping 11 matching lines...) Expand all
22 LayerFilteringTransport::LayerFilteringTransport( 22 LayerFilteringTransport::LayerFilteringTransport(
23 const FakeNetworkPipe::Config& config, 23 const FakeNetworkPipe::Config& config,
24 uint8_t vp8_video_payload_type, 24 uint8_t vp8_video_payload_type,
25 uint8_t vp9_video_payload_type, 25 uint8_t vp9_video_payload_type,
26 uint8_t tl_discard_threshold, 26 uint8_t tl_discard_threshold,
27 uint8_t sl_discard_threshold) 27 uint8_t sl_discard_threshold)
28 : test::DirectTransport(config), 28 : test::DirectTransport(config),
29 vp8_video_payload_type_(vp8_video_payload_type), 29 vp8_video_payload_type_(vp8_video_payload_type),
30 vp9_video_payload_type_(vp9_video_payload_type), 30 vp9_video_payload_type_(vp9_video_payload_type),
31 tl_discard_threshold_(tl_discard_threshold), 31 tl_discard_threshold_(tl_discard_threshold),
32 sl_discard_threshold_(sl_discard_threshold), 32 sl_discard_threshold_(sl_discard_threshold) {
33 current_seq_num_(10000) { 33 }
34 } // TODO(ivica): random seq num? 34
35 uint16_t LayerFilteringTransport::NextSequenceNumber(uint32_t ssrc) {
36 auto it = current_seq_nums_.find(ssrc);
37 if (it == current_seq_nums_.end())
38 return current_seq_nums_[ssrc] = 10000;
39 return ++it->second;
40 }
35 41
36 bool LayerFilteringTransport::SendRtp(const uint8_t* packet, 42 bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
37 size_t length, 43 size_t length,
38 const PacketOptions& options) { 44 const PacketOptions& options) {
39 if (tl_discard_threshold_ == 0 && sl_discard_threshold_ == 0) { 45 if (tl_discard_threshold_ == 0 && sl_discard_threshold_ == 0) {
40 // Nothing to change, forward the packet immediately. 46 // Nothing to change, forward the packet immediately.
41 return test::DirectTransport::SendRtp(packet, length, options); 47 return test::DirectTransport::SendRtp(packet, length, options);
42 } 48 }
43 49
44 bool set_marker_bit = false; 50 bool set_marker_bit = false;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 RTC_NOTREACHED() << "Parse error"; 87 RTC_NOTREACHED() << "Parse error";
82 } 88 }
83 } 89 }
84 90
85 uint8_t temp_buffer[IP_PACKET_SIZE]; 91 uint8_t temp_buffer[IP_PACKET_SIZE];
86 memcpy(temp_buffer, packet, length); 92 memcpy(temp_buffer, packet, length);
87 93
88 // We are discarding some of the packets (specifically, whole layers), so 94 // We are discarding some of the packets (specifically, whole layers), so
89 // make sure the marker bit is set properly, and that sequence numbers are 95 // make sure the marker bit is set properly, and that sequence numbers are
90 // continuous. 96 // continuous.
91 if (set_marker_bit) { 97 if (set_marker_bit)
92 temp_buffer[1] |= kRtpMarkerBitMask; 98 temp_buffer[1] |= kRtpMarkerBitMask;
93 }
94 ByteWriter<uint16_t>::WriteBigEndian(&temp_buffer[2], current_seq_num_);
95 99
96 ++current_seq_num_; // Increase only if packet not discarded. 100 uint16_t seq_num = NextSequenceNumber(header.ssrc);
97 101 ByteWriter<uint16_t>::WriteBigEndian(&temp_buffer[2], seq_num);
98 return test::DirectTransport::SendRtp(temp_buffer, length, options); 102 return test::DirectTransport::SendRtp(temp_buffer, length, options);
99 } 103 }
100 104
101 } // namespace test 105 } // namespace test
102 } // namespace webrtc 106 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/layer_filtering_transport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698