| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 int payload_type) | 25 int payload_type) |
| 26 : payload_len_samples_(payload_len_samples), | 26 : payload_len_samples_(payload_len_samples), |
| 27 packet_len_bytes_(2 * payload_len_samples_ + kHeaderLenBytes), | 27 packet_len_bytes_(2 * payload_len_samples_ + kHeaderLenBytes), |
| 28 samples_per_ms_(sample_rate_hz / 1000), | 28 samples_per_ms_(sample_rate_hz / 1000), |
| 29 next_arrival_time_ms_(0.0), | 29 next_arrival_time_ms_(0.0), |
| 30 payload_type_(payload_type), | 30 payload_type_(payload_type), |
| 31 seq_number_(0), | 31 seq_number_(0), |
| 32 timestamp_(0), | 32 timestamp_(0), |
| 33 payload_ssrc_(0xABCD1234) { | 33 payload_ssrc_(0xABCD1234) { |
| 34 size_t encoded_len = WebRtcPcm16b_Encode(&sample_value, 1, encoded_sample_); | 34 size_t encoded_len = WebRtcPcm16b_Encode(&sample_value, 1, encoded_sample_); |
| 35 CHECK_EQ(2U, encoded_len); | 35 RTC_CHECK_EQ(2U, encoded_len); |
| 36 } | 36 } |
| 37 | 37 |
| 38 Packet* ConstantPcmPacketSource::NextPacket() { | 38 Packet* ConstantPcmPacketSource::NextPacket() { |
| 39 CHECK_GT(packet_len_bytes_, kHeaderLenBytes); | 39 RTC_CHECK_GT(packet_len_bytes_, kHeaderLenBytes); |
| 40 uint8_t* packet_memory = new uint8_t[packet_len_bytes_]; | 40 uint8_t* packet_memory = new uint8_t[packet_len_bytes_]; |
| 41 // Fill the payload part of the packet memory with the pre-encoded value. | 41 // Fill the payload part of the packet memory with the pre-encoded value. |
| 42 for (unsigned i = 0; i < 2 * payload_len_samples_; ++i) | 42 for (unsigned i = 0; i < 2 * payload_len_samples_; ++i) |
| 43 packet_memory[kHeaderLenBytes + i] = encoded_sample_[i % 2]; | 43 packet_memory[kHeaderLenBytes + i] = encoded_sample_[i % 2]; |
| 44 WriteHeader(packet_memory); | 44 WriteHeader(packet_memory); |
| 45 // |packet| assumes ownership of |packet_memory|. | 45 // |packet| assumes ownership of |packet_memory|. |
| 46 Packet* packet = | 46 Packet* packet = |
| 47 new Packet(packet_memory, packet_len_bytes_, next_arrival_time_ms_); | 47 new Packet(packet_memory, packet_len_bytes_, next_arrival_time_ms_); |
| 48 next_arrival_time_ms_ += payload_len_samples_ / samples_per_ms_; | 48 next_arrival_time_ms_ += payload_len_samples_ / samples_per_ms_; |
| 49 return packet; | 49 return packet; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 packet_memory[8] = payload_ssrc_ >> 24; | 61 packet_memory[8] = payload_ssrc_ >> 24; |
| 62 packet_memory[9] = (payload_ssrc_ >> 16) & 0xFF; | 62 packet_memory[9] = (payload_ssrc_ >> 16) & 0xFF; |
| 63 packet_memory[10] = (payload_ssrc_ >> 8) & 0xFF; | 63 packet_memory[10] = (payload_ssrc_ >> 8) & 0xFF; |
| 64 packet_memory[11] = payload_ssrc_ & 0xFF; | 64 packet_memory[11] = payload_ssrc_ & 0xFF; |
| 65 ++seq_number_; | 65 ++seq_number_; |
| 66 timestamp_ += static_cast<uint32_t>(payload_len_samples_); | 66 timestamp_ += static_cast<uint32_t>(payload_len_samples_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace test | 69 } // namespace test |
| 70 } // namespace webrtc | 70 } // namespace webrtc |
| OLD | NEW |