| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 "webrtc/modules/audio_coding/neteq/tools/packet.h" | 11 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" |
| 12 | 12 |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include <memory> | 15 #include <memory> |
| 16 | 16 |
| 17 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
| 19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 namespace test { | 22 namespace test { |
| 23 | 23 |
| 24 Packet::Packet(uint8_t* packet_memory, | 24 Packet::Packet(uint8_t* packet_memory, |
| 25 size_t allocated_bytes, | 25 size_t allocated_bytes, |
| 26 double time_ms, | 26 double time_ms, |
| 27 const RtpHeaderParser& parser) | 27 const RtpHeaderParser& parser) |
| 28 : payload_memory_(packet_memory), | 28 : payload_memory_(packet_memory), |
| 29 payload_(NULL), | 29 payload_(nullptr), |
| 30 packet_length_bytes_(allocated_bytes), | 30 packet_length_bytes_(allocated_bytes), |
| 31 payload_length_bytes_(0), | 31 payload_length_bytes_(0), |
| 32 virtual_packet_length_bytes_(allocated_bytes), | 32 virtual_packet_length_bytes_(allocated_bytes), |
| 33 virtual_payload_length_bytes_(0), | 33 virtual_payload_length_bytes_(0), |
| 34 time_ms_(time_ms) { | 34 time_ms_(time_ms) { |
| 35 valid_header_ = ParseHeader(parser); | 35 valid_header_ = ParseHeader(parser); |
| 36 } | 36 } |
| 37 | 37 |
| 38 Packet::Packet(uint8_t* packet_memory, | 38 Packet::Packet(uint8_t* packet_memory, |
| 39 size_t allocated_bytes, | 39 size_t allocated_bytes, |
| 40 size_t virtual_packet_length_bytes, | 40 size_t virtual_packet_length_bytes, |
| 41 double time_ms, | 41 double time_ms, |
| 42 const RtpHeaderParser& parser) | 42 const RtpHeaderParser& parser) |
| 43 : payload_memory_(packet_memory), | 43 : payload_memory_(packet_memory), |
| 44 payload_(NULL), | 44 payload_(nullptr), |
| 45 packet_length_bytes_(allocated_bytes), | 45 packet_length_bytes_(allocated_bytes), |
| 46 payload_length_bytes_(0), | 46 payload_length_bytes_(0), |
| 47 virtual_packet_length_bytes_(virtual_packet_length_bytes), | 47 virtual_packet_length_bytes_(virtual_packet_length_bytes), |
| 48 virtual_payload_length_bytes_(0), | 48 virtual_payload_length_bytes_(0), |
| 49 time_ms_(time_ms) { | 49 time_ms_(time_ms) { |
| 50 valid_header_ = ParseHeader(parser); | 50 valid_header_ = ParseHeader(parser); |
| 51 } | 51 } |
| 52 | 52 |
| 53 Packet::Packet(uint8_t* packet_memory, size_t allocated_bytes, double time_ms) | 53 Packet::Packet(uint8_t* packet_memory, size_t allocated_bytes, double time_ms) |
| 54 : payload_memory_(packet_memory), | 54 : payload_memory_(packet_memory), |
| 55 payload_(NULL), | 55 payload_(nullptr), |
| 56 packet_length_bytes_(allocated_bytes), | 56 packet_length_bytes_(allocated_bytes), |
| 57 payload_length_bytes_(0), | 57 payload_length_bytes_(0), |
| 58 virtual_packet_length_bytes_(allocated_bytes), | 58 virtual_packet_length_bytes_(allocated_bytes), |
| 59 virtual_payload_length_bytes_(0), | 59 virtual_payload_length_bytes_(0), |
| 60 time_ms_(time_ms) { | 60 time_ms_(time_ms) { |
| 61 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 61 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
| 62 valid_header_ = ParseHeader(*parser); | 62 valid_header_ = ParseHeader(*parser); |
| 63 } | 63 } |
| 64 | 64 |
| 65 Packet::Packet(uint8_t* packet_memory, | 65 Packet::Packet(uint8_t* packet_memory, |
| 66 size_t allocated_bytes, | 66 size_t allocated_bytes, |
| 67 size_t virtual_packet_length_bytes, | 67 size_t virtual_packet_length_bytes, |
| 68 double time_ms) | 68 double time_ms) |
| 69 : payload_memory_(packet_memory), | 69 : payload_memory_(packet_memory), |
| 70 payload_(NULL), | 70 payload_(nullptr), |
| 71 packet_length_bytes_(allocated_bytes), | 71 packet_length_bytes_(allocated_bytes), |
| 72 payload_length_bytes_(0), | 72 payload_length_bytes_(0), |
| 73 virtual_packet_length_bytes_(virtual_packet_length_bytes), | 73 virtual_packet_length_bytes_(virtual_packet_length_bytes), |
| 74 virtual_payload_length_bytes_(0), | 74 virtual_payload_length_bytes_(0), |
| 75 time_ms_(time_ms) { | 75 time_ms_(time_ms) { |
| 76 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 76 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
| 77 valid_header_ = ParseHeader(*parser); | 77 valid_header_ = ParseHeader(*parser); |
| 78 } | 78 } |
| 79 | 79 |
| 80 Packet::~Packet() = default; | 80 Packet::~Packet() = default; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 destination->payload_type_frequency = header_.payload_type_frequency; | 164 destination->payload_type_frequency = header_.payload_type_frequency; |
| 165 memcpy(&destination->arrOfCSRCs, | 165 memcpy(&destination->arrOfCSRCs, |
| 166 &header_.arrOfCSRCs, | 166 &header_.arrOfCSRCs, |
| 167 sizeof(header_.arrOfCSRCs)); | 167 sizeof(header_.arrOfCSRCs)); |
| 168 memcpy( | 168 memcpy( |
| 169 &destination->extension, &header_.extension, sizeof(header_.extension)); | 169 &destination->extension, &header_.extension, sizeof(header_.extension)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace test | 172 } // namespace test |
| 173 } // namespace webrtc | 173 } // namespace webrtc |
| OLD | NEW |