pcm16b: Make input arrays const and use uint8_t[] for byte arrays
There were both uint8 and uint16 versions of the pcm16b encode and decode functions; this patch removes the latter. BUG=909 R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/34139004 Cr-Commit-Position: refs/heads/master@{#8309} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8309 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -31,7 +31,7 @@ ConstantPcmPacketSource::ConstantPcmPacketSource(size_t payload_len_samples,
|
||||
seq_number_(0),
|
||||
timestamp_(0),
|
||||
payload_ssrc_(0xABCD1234) {
|
||||
int encoded_len = WebRtcPcm16b_EncodeW16(&sample_value, 1, &encoded_sample_);
|
||||
int encoded_len = WebRtcPcm16b_Encode(&sample_value, 1, encoded_sample_);
|
||||
CHECK_EQ(encoded_len, 2);
|
||||
}
|
||||
|
||||
@ -39,9 +39,8 @@ Packet* ConstantPcmPacketSource::NextPacket() {
|
||||
CHECK_GT(packet_len_bytes_, kHeaderLenBytes);
|
||||
uint8_t* packet_memory = new uint8_t[packet_len_bytes_];
|
||||
// Fill the payload part of the packet memory with the pre-encoded value.
|
||||
std::fill_n(reinterpret_cast<int16_t*>(packet_memory + kHeaderLenBytes),
|
||||
payload_len_samples_,
|
||||
encoded_sample_);
|
||||
for (unsigned i = 0; i < 2 * payload_len_samples_; ++i)
|
||||
packet_memory[kHeaderLenBytes + i] = encoded_sample_[i % 2];
|
||||
WriteHeader(packet_memory);
|
||||
// |packet| assumes ownership of |packet_memory|.
|
||||
Packet* packet =
|
||||
|
||||
@ -41,7 +41,7 @@ class ConstantPcmPacketSource : public PacketSource {
|
||||
const size_t kHeaderLenBytes = 12;
|
||||
const size_t payload_len_samples_;
|
||||
const size_t packet_len_bytes_;
|
||||
int16_t encoded_sample_;
|
||||
uint8_t encoded_sample_[2];
|
||||
const int samples_per_ms_;
|
||||
double next_arrival_time_ms_;
|
||||
const int payload_type_;
|
||||
|
||||
Reference in New Issue
Block a user