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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/packet.cc

Issue 1697823002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/neteq/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up-codecs
Patch Set: Created 4 years, 10 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
OLDNEW
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>
16
15 #include "webrtc/modules/include/module_common_types.h" 17 #include "webrtc/modules/include/module_common_types.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
17 19
18 namespace webrtc { 20 namespace webrtc {
19 namespace test { 21 namespace test {
20 22
21 Packet::Packet(uint8_t* packet_memory, 23 Packet::Packet(uint8_t* packet_memory,
22 size_t allocated_bytes, 24 size_t allocated_bytes,
23 double time_ms, 25 double time_ms,
24 const RtpHeaderParser& parser) 26 const RtpHeaderParser& parser)
(...skipping 23 matching lines...) Expand all
48 } 50 }
49 51
50 Packet::Packet(uint8_t* packet_memory, size_t allocated_bytes, double time_ms) 52 Packet::Packet(uint8_t* packet_memory, size_t allocated_bytes, double time_ms)
51 : payload_memory_(packet_memory), 53 : payload_memory_(packet_memory),
52 payload_(NULL), 54 payload_(NULL),
53 packet_length_bytes_(allocated_bytes), 55 packet_length_bytes_(allocated_bytes),
54 payload_length_bytes_(0), 56 payload_length_bytes_(0),
55 virtual_packet_length_bytes_(allocated_bytes), 57 virtual_packet_length_bytes_(allocated_bytes),
56 virtual_payload_length_bytes_(0), 58 virtual_payload_length_bytes_(0),
57 time_ms_(time_ms) { 59 time_ms_(time_ms) {
58 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 60 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
59 valid_header_ = ParseHeader(*parser); 61 valid_header_ = ParseHeader(*parser);
60 } 62 }
61 63
62 Packet::Packet(uint8_t* packet_memory, 64 Packet::Packet(uint8_t* packet_memory,
63 size_t allocated_bytes, 65 size_t allocated_bytes,
64 size_t virtual_packet_length_bytes, 66 size_t virtual_packet_length_bytes,
65 double time_ms) 67 double time_ms)
66 : payload_memory_(packet_memory), 68 : payload_memory_(packet_memory),
67 payload_(NULL), 69 payload_(NULL),
68 packet_length_bytes_(allocated_bytes), 70 packet_length_bytes_(allocated_bytes),
69 payload_length_bytes_(0), 71 payload_length_bytes_(0),
70 virtual_packet_length_bytes_(virtual_packet_length_bytes), 72 virtual_packet_length_bytes_(virtual_packet_length_bytes),
71 virtual_payload_length_bytes_(0), 73 virtual_payload_length_bytes_(0),
72 time_ms_(time_ms) { 74 time_ms_(time_ms) {
73 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 75 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
74 valid_header_ = ParseHeader(*parser); 76 valid_header_ = ParseHeader(*parser);
75 } 77 }
76 78
77 bool Packet::ExtractRedHeaders(std::list<RTPHeader*>* headers) const { 79 bool Packet::ExtractRedHeaders(std::list<RTPHeader*>* headers) const {
78 // 80 //
79 // 0 1 2 3 81 // 0 1 2 3
80 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 82 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
81 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 83 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
82 // |1| block PT | timestamp offset | block length | 84 // |1| block PT | timestamp offset | block length |
83 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 85 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 destination->payload_type_frequency = header_.payload_type_frequency; 160 destination->payload_type_frequency = header_.payload_type_frequency;
159 memcpy(&destination->arrOfCSRCs, 161 memcpy(&destination->arrOfCSRCs,
160 &header_.arrOfCSRCs, 162 &header_.arrOfCSRCs,
161 sizeof(header_.arrOfCSRCs)); 163 sizeof(header_.arrOfCSRCs));
162 memcpy( 164 memcpy(
163 &destination->extension, &header_.extension, sizeof(header_.extension)); 165 &destination->extension, &header_.extension, sizeof(header_.extension));
164 } 166 }
165 167
166 } // namespace test 168 } // namespace test
167 } // namespace webrtc 169 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/packet.h ('k') | webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698