OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 namespace test { | 21 namespace test { |
22 | 22 |
23 LayerFilteringTransport::LayerFilteringTransport( | 23 LayerFilteringTransport::LayerFilteringTransport( |
24 SingleThreadedTaskQueueForTesting* task_queue, | 24 SingleThreadedTaskQueueForTesting* task_queue, |
25 const FakeNetworkPipe::Config& config, | 25 const FakeNetworkPipe::Config& config, |
26 Call* send_call, | 26 Call* send_call, |
27 uint8_t vp8_video_payload_type, | 27 uint8_t vp8_video_payload_type, |
28 uint8_t vp9_video_payload_type, | 28 uint8_t vp9_video_payload_type, |
29 int selected_tl, | 29 int selected_tl, |
30 int selected_sl, | 30 int selected_sl, |
31 const std::map<uint8_t, MediaType>& payload_type_map) | 31 const std::map<uint8_t, MediaType>& payload_type_map, |
32 : DirectTransport(task_queue, config, send_call, payload_type_map), | 32 std::unique_ptr<test::RtpFileWriter> rtp_file_writer) |
| 33 : DirectTransport(task_queue, |
| 34 config, |
| 35 send_call, |
| 36 payload_type_map, |
| 37 std::move(rtp_file_writer)), |
33 vp8_video_payload_type_(vp8_video_payload_type), | 38 vp8_video_payload_type_(vp8_video_payload_type), |
34 vp9_video_payload_type_(vp9_video_payload_type), | 39 vp9_video_payload_type_(vp9_video_payload_type), |
35 selected_tl_(selected_tl), | 40 selected_tl_(selected_tl), |
36 selected_sl_(selected_sl), | 41 selected_sl_(selected_sl), |
37 discarded_last_packet_(false) {} | 42 discarded_last_packet_(false) {} |
38 | 43 |
39 bool LayerFilteringTransport::DiscardedLastPacket() const { | 44 bool LayerFilteringTransport::DiscardedLastPacket() const { |
40 return discarded_last_packet_; | 45 return discarded_last_packet_; |
41 } | 46 } |
42 | 47 |
43 bool LayerFilteringTransport::SendRtp(const uint8_t* packet, | 48 bool LayerFilteringTransport::SendRtp(const uint8_t* packet, |
44 size_t length, | 49 size_t length, |
45 const PacketOptions& options) { | 50 const PacketOptions& options) { |
46 if (selected_tl_ == -1 && selected_sl_ == -1) { | 51 if (selected_tl_ == -1 && selected_sl_ == -1) { |
47 // Nothing to change, forward the packet immediately. | 52 // Nothing to change, forward the packet immediately. |
48 return test::DirectTransport::SendRtp(packet, length, options); | 53 return test::DirectTransport::SendRtp(packet, length, options); |
49 } | 54 } |
50 | 55 |
51 bool set_marker_bit = false; | 56 bool set_marker_bit = false; |
52 RtpUtility::RtpHeaderParser parser(packet, length); | 57 RtpUtility::RtpHeaderParser parser(packet, length); |
53 RTPHeader header; | 58 RTPHeader header; |
54 parser.Parse(&header); | 59 parser.Parse(&header); |
55 | |
56 RTC_DCHECK_LE(length, IP_PACKET_SIZE); | 60 RTC_DCHECK_LE(length, IP_PACKET_SIZE); |
57 uint8_t temp_buffer[IP_PACKET_SIZE]; | 61 uint8_t temp_buffer[IP_PACKET_SIZE]; |
58 memcpy(temp_buffer, packet, length); | 62 memcpy(temp_buffer, packet, length); |
59 | 63 |
60 if (header.payloadType == vp8_video_payload_type_ || | 64 if (header.payloadType == vp8_video_payload_type_ || |
61 header.payloadType == vp9_video_payload_type_) { | 65 header.payloadType == vp9_video_payload_type_) { |
62 const uint8_t* payload = packet + header.headerLength; | 66 const uint8_t* payload = packet + header.headerLength; |
63 RTC_DCHECK_GT(length, header.headerLength); | 67 RTC_DCHECK_GT(length, header.headerLength); |
64 const size_t payload_length = length - header.headerLength; | 68 const size_t payload_length = length - header.headerLength; |
65 RTC_DCHECK_GT(payload_length, header.paddingLength); | 69 RTC_DCHECK_GT(payload_length, header.paddingLength); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // make sure the marker bit is set properly, and that sequence numbers are | 104 // make sure the marker bit is set properly, and that sequence numbers are |
101 // continuous. | 105 // continuous. |
102 if (set_marker_bit) | 106 if (set_marker_bit) |
103 temp_buffer[1] |= kRtpMarkerBitMask; | 107 temp_buffer[1] |= kRtpMarkerBitMask; |
104 | 108 |
105 return test::DirectTransport::SendRtp(temp_buffer, length, options); | 109 return test::DirectTransport::SendRtp(temp_buffer, length, options); |
106 } | 110 } |
107 | 111 |
108 } // namespace test | 112 } // namespace test |
109 } // namespace webrtc | 113 } // namespace webrtc |
OLD | NEW |