| 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 |
| 11 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" | 11 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 #include <memory.h> // memset | 14 #include <memory.h> // memset |
| 15 | 15 |
| 16 #include <algorithm> | 16 #include <algorithm> |
| 17 #include <utility> |
| 17 #include <vector> | 18 #include <vector> |
| 18 | 19 |
| 19 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/safe_conversions.h" | 22 #include "webrtc/base/safe_conversions.h" |
| 22 #include "webrtc/base/sanitizer.h" | 23 #include "webrtc/base/sanitizer.h" |
| 23 #include "webrtc/base/trace_event.h" | 24 #include "webrtc/base/trace_event.h" |
| 24 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 25 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 25 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 26 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 26 #include "webrtc/modules/audio_coding/neteq/accelerate.h" | 27 #include "webrtc/modules/audio_coding/neteq/accelerate.h" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 if (ret != PayloadSplitter::kOK) { | 624 if (ret != PayloadSplitter::kOK) { |
| 624 PacketBuffer::DeleteAllPackets(&packet_list); | 625 PacketBuffer::DeleteAllPackets(&packet_list); |
| 625 switch (ret) { | 626 switch (ret) { |
| 626 case PayloadSplitter::kUnknownPayloadType: | 627 case PayloadSplitter::kUnknownPayloadType: |
| 627 return kUnknownRtpPayloadType; | 628 return kUnknownRtpPayloadType; |
| 628 default: | 629 default: |
| 629 return kOtherError; | 630 return kOtherError; |
| 630 } | 631 } |
| 631 } | 632 } |
| 632 | 633 |
| 633 // Split payloads into smaller chunks. This also verifies that all payloads | |
| 634 // are of a known payload type. | |
| 635 ret = payload_splitter_->SplitAudio(&packet_list, *decoder_database_); | |
| 636 if (ret != PayloadSplitter::kOK) { | |
| 637 PacketBuffer::DeleteAllPackets(&packet_list); | |
| 638 switch (ret) { | |
| 639 case PayloadSplitter::kUnknownPayloadType: | |
| 640 return kUnknownRtpPayloadType; | |
| 641 case PayloadSplitter::kFrameSplitError: | |
| 642 return kFrameSplitError; | |
| 643 default: | |
| 644 return kOtherError; | |
| 645 } | |
| 646 } | |
| 647 | |
| 648 // Update bandwidth estimate, if the packet is not comfort noise. | 634 // Update bandwidth estimate, if the packet is not comfort noise. |
| 649 if (!packet_list.empty() && | 635 if (!packet_list.empty() && |
| 650 !decoder_database_->IsComfortNoise(main_header.payloadType)) { | 636 !decoder_database_->IsComfortNoise(main_header.payloadType)) { |
| 651 // The list can be empty here if we got nothing but DTMF payloads. | 637 // The list can be empty here if we got nothing but DTMF payloads. |
| 652 AudioDecoder* decoder = | 638 AudioDecoder* decoder = |
| 653 decoder_database_->GetDecoder(main_header.payloadType); | 639 decoder_database_->GetDecoder(main_header.payloadType); |
| 654 assert(decoder); // Should always get a valid object, since we have | 640 assert(decoder); // Should always get a valid object, since we have |
| 655 // already checked that the payload types are known. | 641 // already checked that the payload types are known. |
| 656 decoder->IncomingPacket(packet_list.front()->payload.data(), | 642 decoder->IncomingPacket(packet_list.front()->payload.data(), |
| 657 packet_list.front()->payload.size(), | 643 packet_list.front()->payload.size(), |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 } | 2091 } |
| 2106 } | 2092 } |
| 2107 | 2093 |
| 2108 void NetEqImpl::CreateDecisionLogic() { | 2094 void NetEqImpl::CreateDecisionLogic() { |
| 2109 decision_logic_.reset(DecisionLogic::Create( | 2095 decision_logic_.reset(DecisionLogic::Create( |
| 2110 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2096 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
| 2111 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2097 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
| 2112 tick_timer_.get())); | 2098 tick_timer_.get())); |
| 2113 } | 2099 } |
| 2114 } // namespace webrtc | 2100 } // namespace webrtc |
| OLD | NEW |