Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1119)

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2326003002: Moved codec-specific audio packet splitting into decoders. (Closed)
Patch Set: Fixed types in packet splitting (size_t vs. uint32_t) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (ret != PayloadSplitter::kOK) { 625 if (ret != PayloadSplitter::kOK) {
626 PacketBuffer::DeleteAllPackets(&packet_list); 626 PacketBuffer::DeleteAllPackets(&packet_list);
627 switch (ret) { 627 switch (ret) {
628 case PayloadSplitter::kUnknownPayloadType: 628 case PayloadSplitter::kUnknownPayloadType:
629 return kUnknownRtpPayloadType; 629 return kUnknownRtpPayloadType;
630 default: 630 default:
631 return kOtherError; 631 return kOtherError;
632 } 632 }
633 } 633 }
634 634
635 // Split payloads into smaller chunks. This also verifies that all payloads
636 // are of a known payload type.
637 ret = payload_splitter_->SplitAudio(&packet_list, *decoder_database_);
638 if (ret != PayloadSplitter::kOK) {
639 PacketBuffer::DeleteAllPackets(&packet_list);
640 switch (ret) {
641 case PayloadSplitter::kUnknownPayloadType:
642 return kUnknownRtpPayloadType;
643 case PayloadSplitter::kFrameSplitError:
644 return kFrameSplitError;
645 default:
646 return kOtherError;
647 }
648 }
649
650 // Update bandwidth estimate, if the packet is not comfort noise. 635 // Update bandwidth estimate, if the packet is not comfort noise.
651 if (!packet_list.empty() && 636 if (!packet_list.empty() &&
652 !decoder_database_->IsComfortNoise(main_header.payloadType)) { 637 !decoder_database_->IsComfortNoise(main_header.payloadType)) {
653 // The list can be empty here if we got nothing but DTMF payloads. 638 // The list can be empty here if we got nothing but DTMF payloads.
654 AudioDecoder* decoder = 639 AudioDecoder* decoder =
655 decoder_database_->GetDecoder(main_header.payloadType); 640 decoder_database_->GetDecoder(main_header.payloadType);
656 assert(decoder); // Should always get a valid object, since we have 641 assert(decoder); // Should always get a valid object, since we have
657 // already checked that the payload types are known. 642 // already checked that the payload types are known.
658 decoder->IncomingPacket(packet_list.front()->payload.data(), 643 decoder->IncomingPacket(packet_list.front()->payload.data(),
659 packet_list.front()->payload.size(), 644 packet_list.front()->payload.size(),
(...skipping 17 matching lines...) Expand all
677 // Carry comfort noise packets along. 662 // Carry comfort noise packets along.
678 parsed_packet_list.push_back(packet.release()); 663 parsed_packet_list.push_back(packet.release());
679 } else { 664 } else {
680 std::vector<AudioDecoder::ParseResult> results = 665 std::vector<AudioDecoder::ParseResult> results =
681 info->GetDecoder()->ParsePayload(std::move(packet->payload), 666 info->GetDecoder()->ParsePayload(std::move(packet->payload),
682 packet->header.timestamp, 667 packet->header.timestamp,
683 packet->primary); 668 packet->primary);
684 const RTPHeader& original_header = packet->header; 669 const RTPHeader& original_header = packet->header;
685 for (auto& result : results) { 670 for (auto& result : results) {
686 RTC_DCHECK(result.frame); 671 RTC_DCHECK(result.frame);
687 // Reuse the packet if possible 672 // Reuse the packet if possible.
688 if (!packet) { 673 if (!packet) {
689 packet.reset(new Packet); 674 packet.reset(new Packet);
690 packet->header = original_header; 675 packet->header = original_header;
691 } 676 }
692 packet->header.timestamp = result.timestamp; 677 packet->header.timestamp = result.timestamp;
693 // TODO(ossu): Move from primary to some sort of priority level. 678 // TODO(ossu): Move from primary to some sort of priority level.
694 packet->primary = result.primary; 679 packet->primary = result.primary;
695 packet->frame = std::move(result.frame); 680 packet->frame = std::move(result.frame);
696 parsed_packet_list.push_back(packet.release()); 681 parsed_packet_list.push_back(packet.release());
697 } 682 }
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 } 2084 }
2100 } 2085 }
2101 2086
2102 void NetEqImpl::CreateDecisionLogic() { 2087 void NetEqImpl::CreateDecisionLogic() {
2103 decision_logic_.reset(DecisionLogic::Create( 2088 decision_logic_.reset(DecisionLogic::Create(
2104 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2089 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2105 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2090 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2106 tick_timer_.get())); 2091 tick_timer_.get()));
2107 } 2092 }
2108 } // namespace webrtc 2093 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698