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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_send_test_oldapi.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 26 matching lines...) Expand all
37 // Registers the send codec. Returns true on success, false otherwise. 37 // Registers the send codec. Returns true on success, false otherwise.
38 bool RegisterCodec(const char* payload_name, 38 bool RegisterCodec(const char* payload_name,
39 int sampling_freq_hz, 39 int sampling_freq_hz,
40 int channels, 40 int channels,
41 int payload_type, 41 int payload_type,
42 int frame_size_samples); 42 int frame_size_samples);
43 43
44 // Registers an external send codec. Returns true on success, false otherwise. 44 // Registers an external send codec. Returns true on success, false otherwise.
45 bool RegisterExternalCodec(AudioEncoder* external_speech_encoder); 45 bool RegisterExternalCodec(AudioEncoder* external_speech_encoder);
46 46
47 // Returns the next encoded packet. Returns NULL if the test duration was
48 // exceeded. Ownership of the packet is handed over to the caller.
49 // Inherited from PacketSource. 47 // Inherited from PacketSource.
50 Packet* NextPacket() override; 48 std::unique_ptr<Packet> NextPacket() override;
51 49
52 // Inherited from AudioPacketizationCallback. 50 // Inherited from AudioPacketizationCallback.
53 int32_t SendData(FrameType frame_type, 51 int32_t SendData(FrameType frame_type,
54 uint8_t payload_type, 52 uint8_t payload_type,
55 uint32_t timestamp, 53 uint32_t timestamp,
56 const uint8_t* payload_data, 54 const uint8_t* payload_data,
57 size_t payload_len_bytes, 55 size_t payload_len_bytes,
58 const RTPFragmentationHeader* fragmentation) override; 56 const RTPFragmentationHeader* fragmentation) override;
59 57
60 AudioCodingModule* acm() { return acm_.get(); } 58 AudioCodingModule* acm() { return acm_.get(); }
61 59
62 private: 60 private:
63 static const int kBlockSizeMs = 10; 61 static const int kBlockSizeMs = 10;
64 62
65 // Creates a Packet object from the last packet produced by ACM (and received 63 // Creates a Packet object from the last packet produced by ACM (and received
66 // through the SendData method as a callback). Ownership of the new Packet 64 // through the SendData method as a callback). Ownership of the new Packet
67 // object is transferred to the caller. 65 // object is transferred to the caller.
kwiberg-webrtc 2016/05/24 09:04:56 The last sentence is no longer needed.
hlundin-webrtc 2016/05/24 10:59:15 Done.
68 Packet* CreatePacket(); 66 std::unique_ptr<Packet> CreatePacket();
69 67
70 SimulatedClock clock_; 68 SimulatedClock clock_;
71 std::unique_ptr<AudioCodingModule> acm_; 69 std::unique_ptr<AudioCodingModule> acm_;
72 InputAudioFile* audio_source_; 70 InputAudioFile* audio_source_;
73 int source_rate_hz_; 71 int source_rate_hz_;
74 const size_t input_block_size_samples_; 72 const size_t input_block_size_samples_;
75 AudioFrame input_frame_; 73 AudioFrame input_frame_;
76 bool codec_registered_; 74 bool codec_registered_;
77 int test_duration_ms_; 75 int test_duration_ms_;
78 // The following member variables are set whenever SendData() is called. 76 // The following member variables are set whenever SendData() is called.
79 FrameType frame_type_; 77 FrameType frame_type_;
80 int payload_type_; 78 int payload_type_;
81 uint32_t timestamp_; 79 uint32_t timestamp_;
82 uint16_t sequence_number_; 80 uint16_t sequence_number_;
83 std::vector<uint8_t> last_payload_vec_; 81 std::vector<uint8_t> last_payload_vec_;
84 bool data_to_send_; 82 bool data_to_send_;
85 83
86 RTC_DISALLOW_COPY_AND_ASSIGN(AcmSendTestOldApi); 84 RTC_DISALLOW_COPY_AND_ASSIGN(AcmSendTestOldApi);
87 }; 85 };
88 86
89 } // namespace test 87 } // namespace test
90 } // namespace webrtc 88 } // namespace webrtc
91 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_SEND_TEST_OLDAPI_H_ 89 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_SEND_TEST_OLDAPI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698