| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // is not defined outside of this block. | 529 // is not defined outside of this block. |
| 530 Packet* packet = new Packet; | 530 Packet* packet = new Packet; |
| 531 packet->header.markerBit = false; | 531 packet->header.markerBit = false; |
| 532 packet->header.payloadType = rtp_header.header.payloadType; | 532 packet->header.payloadType = rtp_header.header.payloadType; |
| 533 packet->header.sequenceNumber = rtp_header.header.sequenceNumber; | 533 packet->header.sequenceNumber = rtp_header.header.sequenceNumber; |
| 534 packet->header.timestamp = rtp_header.header.timestamp; | 534 packet->header.timestamp = rtp_header.header.timestamp; |
| 535 packet->header.ssrc = rtp_header.header.ssrc; | 535 packet->header.ssrc = rtp_header.header.ssrc; |
| 536 packet->header.numCSRCs = 0; | 536 packet->header.numCSRCs = 0; |
| 537 packet->payload_length = payload.size(); | 537 packet->payload_length = payload.size(); |
| 538 packet->primary = true; | 538 packet->primary = true; |
| 539 packet->waiting_time = 0; | 539 // Waiting time will be set upon inserting the packet in the buffer. |
| 540 RTC_DCHECK(!packet->waiting_time); |
| 540 packet->payload = new uint8_t[packet->payload_length]; | 541 packet->payload = new uint8_t[packet->payload_length]; |
| 541 packet->sync_packet = is_sync_packet; | 542 packet->sync_packet = is_sync_packet; |
| 542 if (!packet->payload) { | 543 if (!packet->payload) { |
| 543 LOG_F(LS_ERROR) << "Payload pointer is NULL."; | 544 LOG_F(LS_ERROR) << "Payload pointer is NULL."; |
| 544 } | 545 } |
| 545 assert(!payload.empty()); // Already checked above. | 546 assert(!payload.empty()); // Already checked above. |
| 546 memcpy(packet->payload, payload.data(), packet->payload_length); | 547 memcpy(packet->payload, payload.data(), packet->payload_length); |
| 547 // Insert packet in a packet list. | 548 // Insert packet in a packet list. |
| 548 packet_list.push_back(packet); | 549 packet_list.push_back(packet); |
| 549 // Save main payloads header for later. | 550 // Save main payloads header for later. |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 996 |
| 996 int NetEqImpl::GetDecision(Operations* operation, | 997 int NetEqImpl::GetDecision(Operations* operation, |
| 997 PacketList* packet_list, | 998 PacketList* packet_list, |
| 998 DtmfEvent* dtmf_event, | 999 DtmfEvent* dtmf_event, |
| 999 bool* play_dtmf) { | 1000 bool* play_dtmf) { |
| 1000 // Initialize output variables. | 1001 // Initialize output variables. |
| 1001 *play_dtmf = false; | 1002 *play_dtmf = false; |
| 1002 *operation = kUndefined; | 1003 *operation = kUndefined; |
| 1003 | 1004 |
| 1004 // Increment time counters. | 1005 // Increment time counters. |
| 1005 packet_buffer_->IncrementWaitingTimes(); | |
| 1006 stats_.IncreaseCounter(output_size_samples_, fs_hz_); | 1006 stats_.IncreaseCounter(output_size_samples_, fs_hz_); |
| 1007 | 1007 |
| 1008 assert(sync_buffer_.get()); | 1008 assert(sync_buffer_.get()); |
| 1009 uint32_t end_timestamp = sync_buffer_->end_timestamp(); | 1009 uint32_t end_timestamp = sync_buffer_->end_timestamp(); |
| 1010 if (!new_codec_) { | 1010 if (!new_codec_) { |
| 1011 const uint32_t five_seconds_samples = 5 * fs_hz_; | 1011 const uint32_t five_seconds_samples = 5 * fs_hz_; |
| 1012 packet_buffer_->DiscardOldPackets(end_timestamp, five_seconds_samples); | 1012 packet_buffer_->DiscardOldPackets(end_timestamp, five_seconds_samples); |
| 1013 } | 1013 } |
| 1014 const RTPHeader* header = packet_buffer_->NextRtpHeader(); | 1014 const RTPHeader* header = packet_buffer_->NextRtpHeader(); |
| 1015 | 1015 |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 size_t discard_count = 0; | 1924 size_t discard_count = 0; |
| 1925 Packet* packet = packet_buffer_->GetNextPacket(&discard_count); | 1925 Packet* packet = packet_buffer_->GetNextPacket(&discard_count); |
| 1926 // |header| may be invalid after the |packet_buffer_| operation. | 1926 // |header| may be invalid after the |packet_buffer_| operation. |
| 1927 header = NULL; | 1927 header = NULL; |
| 1928 if (!packet) { | 1928 if (!packet) { |
| 1929 LOG(LS_ERROR) << "Should always be able to extract a packet here"; | 1929 LOG(LS_ERROR) << "Should always be able to extract a packet here"; |
| 1930 assert(false); // Should always be able to extract a packet here. | 1930 assert(false); // Should always be able to extract a packet here. |
| 1931 return -1; | 1931 return -1; |
| 1932 } | 1932 } |
| 1933 stats_.PacketsDiscarded(discard_count); | 1933 stats_.PacketsDiscarded(discard_count); |
| 1934 // Store waiting time in ms; packets->waiting_time is in "output blocks". | 1934 stats_.StoreWaitingTime(packet->waiting_time->ElapsedMs()); |
| 1935 stats_.StoreWaitingTime(packet->waiting_time * kOutputSizeMs); | |
| 1936 assert(packet->payload_length > 0); | 1935 assert(packet->payload_length > 0); |
| 1937 packet_list->push_back(packet); // Store packet in list. | 1936 packet_list->push_back(packet); // Store packet in list. |
| 1938 | 1937 |
| 1939 if (first_packet) { | 1938 if (first_packet) { |
| 1940 first_packet = false; | 1939 first_packet = false; |
| 1941 if (nack_enabled_) { | 1940 if (nack_enabled_) { |
| 1942 RTC_DCHECK(nack_); | 1941 RTC_DCHECK(nack_); |
| 1943 // TODO(henrik.lundin): Should we update this for all decoded packets? | 1942 // TODO(henrik.lundin): Should we update this for all decoded packets? |
| 1944 nack_->UpdateLastDecodedPacket(packet->header.sequenceNumber, | 1943 nack_->UpdateLastDecodedPacket(packet->header.sequenceNumber, |
| 1945 packet->header.timestamp); | 1944 packet->header.timestamp); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 | 2105 |
| 2107 void NetEqImpl::CreateDecisionLogic() { | 2106 void NetEqImpl::CreateDecisionLogic() { |
| 2108 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 2107 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
| 2109 playout_mode_, | 2108 playout_mode_, |
| 2110 decoder_database_.get(), | 2109 decoder_database_.get(), |
| 2111 *packet_buffer_.get(), | 2110 *packet_buffer_.get(), |
| 2112 delay_manager_.get(), | 2111 delay_manager_.get(), |
| 2113 buffer_level_filter_.get())); | 2112 buffer_level_filter_.get())); |
| 2114 } | 2113 } |
| 2115 } // namespace webrtc | 2114 } // namespace webrtc |
| OLD | NEW |