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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.h

Issue 2005873002: Let PacketSource::NextPacket() return an std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
(...skipping 13 matching lines...) Expand all
24 // This class implements a packet source that delivers PCM16b encoded packets 24 // This class implements a packet source that delivers PCM16b encoded packets
25 // with a constant sample value. The payload length, constant sample value, 25 // with a constant sample value. The payload length, constant sample value,
26 // sample rate, and payload type are all set in the constructor. 26 // sample rate, and payload type are all set in the constructor.
27 class ConstantPcmPacketSource : public PacketSource { 27 class ConstantPcmPacketSource : public PacketSource {
28 public: 28 public:
29 ConstantPcmPacketSource(size_t payload_len_samples, 29 ConstantPcmPacketSource(size_t payload_len_samples,
30 int16_t sample_value, 30 int16_t sample_value,
31 int sample_rate_hz, 31 int sample_rate_hz,
32 int payload_type); 32 int payload_type);
33 33
34 // Returns a pointer to the next packet. Will never return NULL. That is, 34 std::unique_ptr<Packet> NextPacket() override;
35 // the source is infinite.
kwiberg-webrtc 2016/05/24 09:04:56 Is this comment no longer necessary? To me it look
hlundin-webrtc 2016/05/24 10:59:15 I try to only document interface methods in the in
kwiberg-webrtc 2016/05/24 11:26:47 Acknowledged.
36 Packet* NextPacket() override;
37 35
38 private: 36 private:
39 void WriteHeader(uint8_t* packet_memory); 37 void WriteHeader(uint8_t* packet_memory);
40 38
41 const size_t kHeaderLenBytes = 12; 39 const size_t kHeaderLenBytes = 12;
42 const size_t payload_len_samples_; 40 const size_t payload_len_samples_;
43 const size_t packet_len_bytes_; 41 const size_t packet_len_bytes_;
44 uint8_t encoded_sample_[2]; 42 uint8_t encoded_sample_[2];
45 const int samples_per_ms_; 43 const int samples_per_ms_;
46 double next_arrival_time_ms_; 44 double next_arrival_time_ms_;
47 const int payload_type_; 45 const int payload_type_;
48 uint16_t seq_number_; 46 uint16_t seq_number_;
49 uint32_t timestamp_; 47 uint32_t timestamp_;
50 const uint32_t payload_ssrc_; 48 const uint32_t payload_ssrc_;
51 49
52 RTC_DISALLOW_COPY_AND_ASSIGN(ConstantPcmPacketSource); 50 RTC_DISALLOW_COPY_AND_ASSIGN(ConstantPcmPacketSource);
53 }; 51 };
54 52
55 } // namespace test 53 } // namespace test
56 } // namespace webrtc 54 } // namespace webrtc
57 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_CONSTANT_PCM_PACKET_SOURCE_H_ 55 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_CONSTANT_PCM_PACKET_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698