Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| index d9ae15e7faa3481b2dff43b5a71c5f57f2cbff3f..b89fd4a490da2a87bd37998c716376cd183f7bd6 100644 |
| --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| @@ -121,17 +121,16 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config, |
| NetEqImpl::~NetEqImpl() = default; |
| int NetEqImpl::InsertPacket(const WebRtcRTPHeader& rtp_header, |
| - const uint8_t* payload, |
| - size_t length_bytes, |
| + rtc::ArrayView<const uint8_t> payload, |
| uint32_t receive_timestamp) { |
| CriticalSectionScoped lock(crit_sect_.get()); |
| - LOG(LS_VERBOSE) << "InsertPacket: ts=" << rtp_header.header.timestamp << |
| - ", sn=" << rtp_header.header.sequenceNumber << |
| - ", pt=" << static_cast<int>(rtp_header.header.payloadType) << |
| - ", ssrc=" << rtp_header.header.ssrc << |
| - ", len=" << length_bytes; |
| - int error = InsertPacketInternal(rtp_header, payload, length_bytes, |
| - receive_timestamp, false); |
| + LOG(LS_VERBOSE) << "InsertPacket: ts=" << rtp_header.header.timestamp |
| + << ", sn=" << rtp_header.header.sequenceNumber |
| + << ", pt=" << static_cast<int>(rtp_header.header.payloadType) |
| + << ", ssrc=" << rtp_header.header.ssrc |
| + << ", len=" << payload.size(); |
| + int error = |
| + InsertPacketInternal(rtp_header, payload, receive_timestamp, false); |
| if (error != 0) { |
| error_code_ = error; |
| return kFail; |
| @@ -149,8 +148,8 @@ int NetEqImpl::InsertSyncPacket(const WebRtcRTPHeader& rtp_header, |
| ", ssrc=" << rtp_header.header.ssrc; |
| const uint8_t kSyncPayload[] = { 's', 'y', 'n', 'c' }; |
| - int error = InsertPacketInternal( |
| - rtp_header, kSyncPayload, sizeof(kSyncPayload), receive_timestamp, true); |
| + int error = |
| + InsertPacketInternal(rtp_header, kSyncPayload, receive_timestamp, true); |
| if (error != 0) { |
| error_code_ = error; |
| @@ -445,11 +444,10 @@ const SyncBuffer* NetEqImpl::sync_buffer_for_test() const { |
| // Methods below this line are private. |
| int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| - const uint8_t* payload, |
| - size_t length_bytes, |
| + rtc::ArrayView<const uint8_t> payload, |
| uint32_t receive_timestamp, |
| bool is_sync_packet) { |
| - if (!payload) { |
| + if (payload.empty()) { |
| LOG_F(LS_ERROR) << "payload == NULL"; |
|
hlundin-webrtc
2015/11/10 10:14:35
"payload == NULL" is not as correct as it used to
kwiberg-webrtc
2015/11/10 10:27:59
Done.
|
| return kInvalidPointer; |
| } |
| @@ -486,7 +484,7 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| packet->header.timestamp = rtp_header.header.timestamp; |
| packet->header.ssrc = rtp_header.header.ssrc; |
| packet->header.numCSRCs = 0; |
| - packet->payload_length = length_bytes; |
| + packet->payload_length = payload.size(); |
| packet->primary = true; |
| packet->waiting_time = 0; |
| packet->payload = new uint8_t[packet->payload_length]; |
| @@ -494,8 +492,8 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| if (!packet->payload) { |
| LOG_F(LS_ERROR) << "Payload pointer is NULL."; |
| } |
| - assert(payload); // Already checked above. |
| - memcpy(packet->payload, payload, packet->payload_length); |
| + assert(!payload.empty()); // Already checked above. |
| + memcpy(packet->payload, payload.data(), packet->payload_length); |
| // Insert packet in a packet list. |
| packet_list.push_back(packet); |
| // Save main payloads header for later. |