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

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

Issue 1376673004: Add a PacketOptions struct to webrtc::Transport. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comment added 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') | webrtc/test/mock_transport.h » ('j') | 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 15 matching lines...) Expand all
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 current_seq_num_(10000) {
34 } // TODO(ivica): random seq num? 34 } // TODO(ivica): random seq num?
35 35
36 bool LayerFilteringTransport::SendRtp(const uint8_t* packet, size_t length) { 36 bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
37 size_t length,
38 const PacketOptions& options) {
37 if (tl_discard_threshold_ == 0 && sl_discard_threshold_ == 0) { 39 if (tl_discard_threshold_ == 0 && sl_discard_threshold_ == 0) {
38 // Nothing to change, forward the packet immediately. 40 // Nothing to change, forward the packet immediately.
39 return test::DirectTransport::SendRtp(packet, length); 41 return test::DirectTransport::SendRtp(packet, length, options);
40 } 42 }
41 43
42 bool set_marker_bit = false; 44 bool set_marker_bit = false;
43 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 45 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
44 RTPHeader header; 46 RTPHeader header;
45 parser->Parse(packet, length, &header); 47 parser->Parse(packet, length, &header);
46 48
47 if (header.payloadType == vp8_video_payload_type_ || 49 if (header.payloadType == vp8_video_payload_type_ ||
48 header.payloadType == vp9_video_payload_type_) { 50 header.payloadType == vp9_video_payload_type_) {
49 const uint8_t* payload = packet + header.headerLength; 51 const uint8_t* payload = packet + header.headerLength;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // We are discarding some of the packets (specifically, whole layers), so 88 // We are discarding some of the packets (specifically, whole layers), so
87 // make sure the marker bit is set properly, and that sequence numbers are 89 // make sure the marker bit is set properly, and that sequence numbers are
88 // continuous. 90 // continuous.
89 if (set_marker_bit) { 91 if (set_marker_bit) {
90 temp_buffer[1] |= kRtpMarkerBitMask; 92 temp_buffer[1] |= kRtpMarkerBitMask;
91 } 93 }
92 ByteWriter<uint16_t>::WriteBigEndian(&temp_buffer[2], current_seq_num_); 94 ByteWriter<uint16_t>::WriteBigEndian(&temp_buffer[2], current_seq_num_);
93 95
94 ++current_seq_num_; // Increase only if packet not discarded. 96 ++current_seq_num_; // Increase only if packet not discarded.
95 97
96 return test::DirectTransport::SendRtp(temp_buffer, length); 98 return test::DirectTransport::SendRtp(temp_buffer, length, options);
97 } 99 }
98 100
99 } // namespace test 101 } // namespace test
100 } // namespace webrtc 102 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/layer_filtering_transport.h ('k') | webrtc/test/mock_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698