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

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

Issue 2326953003: Added a ParsePayload method to AudioDecoder. (Closed)
Patch Set: Added some casts from size_t to int. 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
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 276 }
276 return kFail; 277 return kFail;
277 } 278 }
278 return kOK; 279 return kOK;
279 } 280 }
280 281
281 int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) { 282 int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {
282 rtc::CritScope lock(&crit_sect_); 283 rtc::CritScope lock(&crit_sect_);
283 int ret = decoder_database_->Remove(rtp_payload_type); 284 int ret = decoder_database_->Remove(rtp_payload_type);
284 if (ret == DecoderDatabase::kOK) { 285 if (ret == DecoderDatabase::kOK) {
286 packet_buffer_->DiscardPacketsWithPayloadType(rtp_payload_type);
285 return kOK; 287 return kOK;
286 } else if (ret == DecoderDatabase::kDecoderNotFound) { 288 } else if (ret == DecoderDatabase::kDecoderNotFound) {
287 error_code_ = kDecoderNotFound; 289 error_code_ = kDecoderNotFound;
288 } else { 290 } else {
289 error_code_ = kOtherError; 291 error_code_ = kOtherError;
290 } 292 }
291 return kFail; 293 return kFail;
292 } 294 }
293 295
294 bool NetEqImpl::SetMinimumDelay(int delay_ms) { 296 bool NetEqImpl::SetMinimumDelay(int delay_ms) {
(...skipping 28 matching lines...) Expand all
323 return kNotImplemented; 325 return kNotImplemented;
324 } 326 }
325 327
326 int NetEqImpl::CurrentDelayMs() const { 328 int NetEqImpl::CurrentDelayMs() const {
327 rtc::CritScope lock(&crit_sect_); 329 rtc::CritScope lock(&crit_sect_);
328 if (fs_hz_ == 0) 330 if (fs_hz_ == 0)
329 return 0; 331 return 0;
330 // Sum up the samples in the packet buffer with the future length of the sync 332 // Sum up the samples in the packet buffer with the future length of the sync
331 // buffer, and divide the sum by the sample rate. 333 // buffer, and divide the sum by the sample rate.
332 const size_t delay_samples = 334 const size_t delay_samples =
333 packet_buffer_->NumSamplesInBuffer(decoder_database_.get(), 335 packet_buffer_->NumSamplesInBuffer(decoder_frame_length_) +
334 decoder_frame_length_) +
335 sync_buffer_->FutureLength(); 336 sync_buffer_->FutureLength();
336 // The division below will truncate. 337 // The division below will truncate.
337 const int delay_ms = 338 const int delay_ms =
338 static_cast<int>(delay_samples) / rtc::CheckedDivExact(fs_hz_, 1000); 339 static_cast<int>(delay_samples) / rtc::CheckedDivExact(fs_hz_, 1000);
339 return delay_ms; 340 return delay_ms;
340 } 341 }
341 342
342 int NetEqImpl::FilteredCurrentDelayMs() const { 343 int NetEqImpl::FilteredCurrentDelayMs() const {
343 rtc::CritScope lock(&crit_sect_); 344 rtc::CritScope lock(&crit_sect_);
344 // Calculate the filtered packet buffer level in samples. The value from 345 // Calculate the filtered packet buffer level in samples. The value from
(...skipping 24 matching lines...) Expand all
369 // TODO(henrik.lundin) Delete. 370 // TODO(henrik.lundin) Delete.
370 NetEqPlayoutMode NetEqImpl::PlayoutMode() const { 371 NetEqPlayoutMode NetEqImpl::PlayoutMode() const {
371 rtc::CritScope lock(&crit_sect_); 372 rtc::CritScope lock(&crit_sect_);
372 return playout_mode_; 373 return playout_mode_;
373 } 374 }
374 375
375 int NetEqImpl::NetworkStatistics(NetEqNetworkStatistics* stats) { 376 int NetEqImpl::NetworkStatistics(NetEqNetworkStatistics* stats) {
376 rtc::CritScope lock(&crit_sect_); 377 rtc::CritScope lock(&crit_sect_);
377 assert(decoder_database_.get()); 378 assert(decoder_database_.get());
378 const size_t total_samples_in_buffers = 379 const size_t total_samples_in_buffers =
379 packet_buffer_->NumSamplesInBuffer(decoder_database_.get(), 380 packet_buffer_->NumSamplesInBuffer(decoder_frame_length_) +
380 decoder_frame_length_) +
381 sync_buffer_->FutureLength(); 381 sync_buffer_->FutureLength();
382 assert(delay_manager_.get()); 382 assert(delay_manager_.get());
383 assert(decision_logic_.get()); 383 assert(decision_logic_.get());
384 stats_.GetNetworkStatistics(fs_hz_, total_samples_in_buffers, 384 stats_.GetNetworkStatistics(fs_hz_, total_samples_in_buffers,
385 decoder_frame_length_, *delay_manager_.get(), 385 decoder_frame_length_, *delay_manager_.get(),
386 *decision_logic_.get(), stats); 386 *decision_logic_.get(), stats);
387 return 0; 387 return 0;
388 } 388 }
389 389
390 void NetEqImpl::GetRtcpStatistics(RtcpStatistics* stats) { 390 void NetEqImpl::GetRtcpStatistics(RtcpStatistics* stats) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 decoder_database_->GetDecoder(main_header.payloadType); 655 decoder_database_->GetDecoder(main_header.payloadType);
656 assert(decoder); // Should always get a valid object, since we have 656 assert(decoder); // Should always get a valid object, since we have
657 // already checked that the payload types are known. 657 // already checked that the payload types are known.
658 decoder->IncomingPacket(packet_list.front()->payload.data(), 658 decoder->IncomingPacket(packet_list.front()->payload.data(),
659 packet_list.front()->payload.size(), 659 packet_list.front()->payload.size(),
660 packet_list.front()->header.sequenceNumber, 660 packet_list.front()->header.sequenceNumber,
661 packet_list.front()->header.timestamp, 661 packet_list.front()->header.timestamp,
662 receive_timestamp); 662 receive_timestamp);
663 } 663 }
664 664
665 PacketList parsed_packet_list;
666 while (!packet_list.empty()) {
667 std::unique_ptr<Packet> packet(packet_list.front());
668 packet_list.pop_front();
669 const DecoderDatabase::DecoderInfo* info =
670 decoder_database_->GetDecoderInfo(packet->header.payloadType);
671 if (!info) {
672 LOG(LS_WARNING) << "SplitAudio unknown payload type";
673 return kUnknownRtpPayloadType;
674 }
675
676 if (info->IsComfortNoise()) {
677 // Carry comfort noise packets along.
678 parsed_packet_list.push_back(packet.release());
679 } else {
680 std::vector<AudioDecoder::ParseResult> results =
681 info->GetDecoder()->ParsePayload(std::move(packet->payload),
682 packet->header.timestamp,
683 packet->primary);
684 const RTPHeader& original_header = packet->header;
685 for (auto& result : results) {
686 RTC_DCHECK(result.frame);
687 // Reuse the packet if possible
688 if (!packet) {
689 packet.reset(new Packet);
690 packet->header = original_header;
691 }
692 packet->header.timestamp = result.timestamp;
693 // TODO(ossu): Move from primary to some sort of priority level.
694 packet->primary = result.primary;
695 packet->frame = std::move(result.frame);
696 parsed_packet_list.push_back(packet.release());
697 }
698 }
699 }
700
665 if (nack_enabled_) { 701 if (nack_enabled_) {
666 RTC_DCHECK(nack_); 702 RTC_DCHECK(nack_);
667 if (update_sample_rate_and_channels) { 703 if (update_sample_rate_and_channels) {
668 nack_->Reset(); 704 nack_->Reset();
669 } 705 }
670 nack_->UpdateLastReceivedPacket(packet_list.front()->header.sequenceNumber, 706 nack_->UpdateLastReceivedPacket(
671 packet_list.front()->header.timestamp); 707 parsed_packet_list.front()->header.sequenceNumber,
708 parsed_packet_list.front()->header.timestamp);
672 } 709 }
673 710
674 // Insert packets in buffer. 711 // Insert packets in buffer.
675 const size_t buffer_length_before_insert = 712 const size_t buffer_length_before_insert =
676 packet_buffer_->NumPacketsInBuffer(); 713 packet_buffer_->NumPacketsInBuffer();
677 ret = packet_buffer_->InsertPacketList( 714 ret = packet_buffer_->InsertPacketList(
678 &packet_list, 715 &parsed_packet_list, *decoder_database_, &current_rtp_payload_type_,
679 *decoder_database_,
680 &current_rtp_payload_type_,
681 &current_cng_rtp_payload_type_); 716 &current_cng_rtp_payload_type_);
682 if (ret == PacketBuffer::kFlushed) { 717 if (ret == PacketBuffer::kFlushed) {
683 // Reset DSP timestamp etc. if packet buffer flushed. 718 // Reset DSP timestamp etc. if packet buffer flushed.
684 new_codec_ = true; 719 new_codec_ = true;
685 update_sample_rate_and_channels = true; 720 update_sample_rate_and_channels = true;
686 } else if (ret != PacketBuffer::kOK) { 721 } else if (ret != PacketBuffer::kOK) {
687 PacketBuffer::DeleteAllPackets(&packet_list); 722 PacketBuffer::DeleteAllPackets(&parsed_packet_list);
688 return kOtherError; 723 return kOtherError;
689 } 724 }
690 725
691 if (first_packet_) { 726 if (first_packet_) {
692 first_packet_ = false; 727 first_packet_ = false;
693 // Update the codec on the next GetAudio call. 728 // Update the codec on the next GetAudio call.
694 new_codec_ = true; 729 new_codec_ = true;
695 } 730 }
696 731
697 if (current_rtp_payload_type_) { 732 if (current_rtp_payload_type_) {
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 !decoder_database_->IsComfortNoise(packet->header.payloadType)) { 1449 !decoder_database_->IsComfortNoise(packet->header.payloadType)) {
1415 assert(decoder); // At this point, we must have a decoder object. 1450 assert(decoder); // At this point, we must have a decoder object.
1416 // The number of channels in the |sync_buffer_| should be the same as the 1451 // The number of channels in the |sync_buffer_| should be the same as the
1417 // number decoder channels. 1452 // number decoder channels.
1418 assert(sync_buffer_->Channels() == decoder->Channels()); 1453 assert(sync_buffer_->Channels() == decoder->Channels());
1419 assert(decoded_buffer_length_ >= kMaxFrameSize * decoder->Channels()); 1454 assert(decoded_buffer_length_ >= kMaxFrameSize * decoder->Channels());
1420 assert(operation == kNormal || operation == kAccelerate || 1455 assert(operation == kNormal || operation == kAccelerate ||
1421 operation == kFastAccelerate || operation == kMerge || 1456 operation == kFastAccelerate || operation == kMerge ||
1422 operation == kPreemptiveExpand); 1457 operation == kPreemptiveExpand);
1423 packet_list->pop_front(); 1458 packet_list->pop_front();
1424 const size_t payload_length = packet->payload.size(); 1459 auto opt_result = packet->frame->Decode(
1425 int decode_length; 1460 rtc::ArrayView<int16_t>(&decoded_buffer_[*decoded_length],
1426 if (!packet->primary) { 1461 decoded_buffer_length_ - *decoded_length));
1427 // This is a redundant payload; call the special decoder method.
1428 decode_length = decoder->DecodeRedundant(
1429 packet->payload.data(), packet->payload.size(), fs_hz_,
1430 (decoded_buffer_length_ - *decoded_length) * sizeof(int16_t),
1431 &decoded_buffer_[*decoded_length], speech_type);
1432 } else {
1433 decode_length = decoder->Decode(
1434 packet->payload.data(), packet->payload.size(), fs_hz_,
1435 (decoded_buffer_length_ - *decoded_length) * sizeof(int16_t),
1436 &decoded_buffer_[*decoded_length], speech_type);
1437 }
1438
1439 delete packet; 1462 delete packet;
1440 packet = NULL; 1463 packet = NULL;
1441 if (decode_length > 0) { 1464 if (opt_result) {
1442 *decoded_length += decode_length; 1465 const auto& result = *opt_result;
1443 // Update |decoder_frame_length_| with number of samples per channel. 1466 *speech_type = result.speech_type;
1444 decoder_frame_length_ = 1467 if (result.num_decoded_samples > 0) {
1445 static_cast<size_t>(decode_length) / decoder->Channels(); 1468 *decoded_length += rtc::checked_cast<int>(result.num_decoded_samples);
1446 } else if (decode_length < 0) { 1469 // Update |decoder_frame_length_| with number of samples per channel.
1470 decoder_frame_length_ =
1471 result.num_decoded_samples / decoder->Channels();
1472 }
1473 } else {
1447 // Error. 1474 // Error.
1448 LOG(LS_WARNING) << "Decode " << decode_length << " " << payload_length; 1475 // TODO(ossu): What to put here?
1476 LOG(LS_WARNING) << "Decode error";
1449 *decoded_length = -1; 1477 *decoded_length = -1;
1450 PacketBuffer::DeleteAllPackets(packet_list); 1478 PacketBuffer::DeleteAllPackets(packet_list);
1451 break; 1479 break;
1452 } 1480 }
1453 if (*decoded_length > static_cast<int>(decoded_buffer_length_)) { 1481 if (*decoded_length > rtc::checked_cast<int>(decoded_buffer_length_)) {
1454 // Guard against overflow. 1482 // Guard against overflow.
1455 LOG(LS_WARNING) << "Decoded too much."; 1483 LOG(LS_WARNING) << "Decoded too much.";
1456 PacketBuffer::DeleteAllPackets(packet_list); 1484 PacketBuffer::DeleteAllPackets(packet_list);
1457 return kDecodedTooMuch; 1485 return kDecodedTooMuch;
1458 } 1486 }
1459 if (!packet_list->empty()) { 1487 if (!packet_list->empty()) {
1460 packet = packet_list->front(); 1488 packet = packet_list->front();
1461 } else { 1489 } else {
1462 packet = NULL; 1490 packet = NULL;
1463 } 1491 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 uint16_t prev_sequence_number = 0; 1913 uint16_t prev_sequence_number = 0;
1886 bool next_packet_available = false; 1914 bool next_packet_available = false;
1887 1915
1888 const RTPHeader* header = packet_buffer_->NextRtpHeader(); 1916 const RTPHeader* header = packet_buffer_->NextRtpHeader();
1889 assert(header); 1917 assert(header);
1890 if (!header) { 1918 if (!header) {
1891 LOG(LS_ERROR) << "Packet buffer unexpectedly empty."; 1919 LOG(LS_ERROR) << "Packet buffer unexpectedly empty.";
1892 return -1; 1920 return -1;
1893 } 1921 }
1894 uint32_t first_timestamp = header->timestamp; 1922 uint32_t first_timestamp = header->timestamp;
1895 int extracted_samples = 0; 1923 size_t extracted_samples = 0;
1896 1924
1897 // Packet extraction loop. 1925 // Packet extraction loop.
1898 do { 1926 do {
1899 timestamp_ = header->timestamp; 1927 timestamp_ = header->timestamp;
1900 size_t discard_count = 0; 1928 size_t discard_count = 0;
1901 Packet* packet = packet_buffer_->GetNextPacket(&discard_count); 1929 Packet* packet = packet_buffer_->GetNextPacket(&discard_count);
1902 // |header| may be invalid after the |packet_buffer_| operation. 1930 // |header| may be invalid after the |packet_buffer_| operation.
1903 header = NULL; 1931 header = NULL;
1904 if (!packet) { 1932 if (!packet) {
1905 LOG(LS_ERROR) << "Should always be able to extract a packet here"; 1933 LOG(LS_ERROR) << "Should always be able to extract a packet here";
1906 assert(false); // Should always be able to extract a packet here. 1934 assert(false); // Should always be able to extract a packet here.
1907 return -1; 1935 return -1;
1908 } 1936 }
1909 stats_.PacketsDiscarded(discard_count); 1937 stats_.PacketsDiscarded(discard_count);
1910 stats_.StoreWaitingTime(packet->waiting_time->ElapsedMs()); 1938 stats_.StoreWaitingTime(packet->waiting_time->ElapsedMs());
1911 assert(!packet->payload.empty()); 1939 RTC_DCHECK(!packet->empty());
1912 packet_list->push_back(packet); // Store packet in list. 1940 packet_list->push_back(packet); // Store packet in list.
1913 1941
1914 if (first_packet) { 1942 if (first_packet) {
1915 first_packet = false; 1943 first_packet = false;
1916 if (nack_enabled_) { 1944 if (nack_enabled_) {
1917 RTC_DCHECK(nack_); 1945 RTC_DCHECK(nack_);
1918 // TODO(henrik.lundin): Should we update this for all decoded packets? 1946 // TODO(henrik.lundin): Should we update this for all decoded packets?
1919 nack_->UpdateLastDecodedPacket(packet->header.sequenceNumber, 1947 nack_->UpdateLastDecodedPacket(packet->header.sequenceNumber,
1920 packet->header.timestamp); 1948 packet->header.timestamp);
1921 } 1949 }
1922 prev_sequence_number = packet->header.sequenceNumber; 1950 prev_sequence_number = packet->header.sequenceNumber;
1923 prev_timestamp = packet->header.timestamp; 1951 prev_timestamp = packet->header.timestamp;
1924 prev_payload_type = packet->header.payloadType; 1952 prev_payload_type = packet->header.payloadType;
1925 } 1953 }
1926 1954
1927 // Store number of extracted samples. 1955 // Store number of extracted samples.
1928 int packet_duration = 0; 1956 size_t packet_duration = 0;
1929 AudioDecoder* decoder = decoder_database_->GetDecoder( 1957 if (packet->frame) {
1930 packet->header.payloadType); 1958 packet_duration = packet->frame->Duration();
1931 if (decoder) { 1959 // TODO(ossu): Is this the correct way to track samples decoded from a
1932 if (packet->primary) { 1960 // redundant packet?
1933 packet_duration = decoder->PacketDuration(packet->payload.data(), 1961 if (packet_duration > 0 && !packet->primary) {
1934 packet->payload.size()); 1962 stats_.SecondaryDecodedSamples(rtc::checked_cast<int>(packet_duration));
1935 } else {
1936 packet_duration = decoder->PacketDurationRedundant(
1937 packet->payload.data(), packet->payload.size());
1938 stats_.SecondaryDecodedSamples(packet_duration);
1939 } 1963 }
1940 } else if (!decoder_database_->IsComfortNoise(packet->header.payloadType)) { 1964 } else if (!decoder_database_->IsComfortNoise(packet->header.payloadType)) {
1941 LOG(LS_WARNING) << "Unknown payload type " 1965 LOG(LS_WARNING) << "Unknown payload type "
1942 << static_cast<int>(packet->header.payloadType); 1966 << static_cast<int>(packet->header.payloadType);
1943 assert(false); 1967 RTC_NOTREACHED();
1944 } 1968 }
1945 if (packet_duration <= 0) { 1969
1970 if (packet_duration == 0) {
1946 // Decoder did not return a packet duration. Assume that the packet 1971 // Decoder did not return a packet duration. Assume that the packet
1947 // contains the same number of samples as the previous one. 1972 // contains the same number of samples as the previous one.
1948 packet_duration = rtc::checked_cast<int>(decoder_frame_length_); 1973 packet_duration = decoder_frame_length_;
1949 } 1974 }
1950 extracted_samples = packet->header.timestamp - first_timestamp + 1975 extracted_samples = packet->header.timestamp - first_timestamp +
1951 packet_duration; 1976 packet_duration;
1952 1977
1953 // Check what packet is available next. 1978 // Check what packet is available next.
1954 header = packet_buffer_->NextRtpHeader(); 1979 header = packet_buffer_->NextRtpHeader();
1955 next_packet_available = false; 1980 next_packet_available = false;
1956 if (header && prev_payload_type == header->payloadType) { 1981 if (header && prev_payload_type == header->payloadType) {
1957 int16_t seq_no_diff = header->sequenceNumber - prev_sequence_number; 1982 int16_t seq_no_diff = header->sequenceNumber - prev_sequence_number;
1958 size_t ts_diff = header->timestamp - prev_timestamp; 1983 size_t ts_diff = header->timestamp - prev_timestamp;
1959 if (seq_no_diff == 1 || 1984 if (seq_no_diff == 1 ||
1960 (seq_no_diff == 0 && ts_diff == decoder_frame_length_)) { 1985 (seq_no_diff == 0 && ts_diff == decoder_frame_length_)) {
1961 // The next sequence number is available, or the next part of a packet 1986 // The next sequence number is available, or the next part of a packet
1962 // that was split into pieces upon insertion. 1987 // that was split into pieces upon insertion.
1963 next_packet_available = true; 1988 next_packet_available = true;
1964 } 1989 }
1965 prev_sequence_number = header->sequenceNumber; 1990 prev_sequence_number = header->sequenceNumber;
1966 } 1991 }
1967 } while (extracted_samples < rtc::checked_cast<int>(required_samples) && 1992 } while (extracted_samples < required_samples && next_packet_available);
1968 next_packet_available);
1969 1993
1970 if (extracted_samples > 0) { 1994 if (extracted_samples > 0) {
1971 // Delete old packets only when we are going to decode something. Otherwise, 1995 // Delete old packets only when we are going to decode something. Otherwise,
1972 // we could end up in the situation where we never decode anything, since 1996 // we could end up in the situation where we never decode anything, since
1973 // all incoming packets are considered too old but the buffer will also 1997 // all incoming packets are considered too old but the buffer will also
1974 // never be flooded and flushed. 1998 // never be flooded and flushed.
1975 packet_buffer_->DiscardAllOldPackets(timestamp_); 1999 packet_buffer_->DiscardAllOldPackets(timestamp_);
1976 } 2000 }
1977 2001
1978 return extracted_samples; 2002 return rtc::checked_cast<int>(extracted_samples);
1979 } 2003 }
1980 2004
1981 void NetEqImpl::UpdatePlcComponents(int fs_hz, size_t channels) { 2005 void NetEqImpl::UpdatePlcComponents(int fs_hz, size_t channels) {
1982 // Delete objects and create new ones. 2006 // Delete objects and create new ones.
1983 expand_.reset(expand_factory_->Create(background_noise_.get(), 2007 expand_.reset(expand_factory_->Create(background_noise_.get(),
1984 sync_buffer_.get(), &random_vector_, 2008 sync_buffer_.get(), &random_vector_,
1985 &stats_, fs_hz, channels)); 2009 &stats_, fs_hz, channels));
1986 merge_.reset(new Merge(fs_hz, channels, expand_.get(), sync_buffer_.get())); 2010 merge_.reset(new Merge(fs_hz, channels, expand_.get(), sync_buffer_.get()));
1987 } 2011 }
1988 2012
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 } 2099 }
2076 } 2100 }
2077 2101
2078 void NetEqImpl::CreateDecisionLogic() { 2102 void NetEqImpl::CreateDecisionLogic() {
2079 decision_logic_.reset(DecisionLogic::Create( 2103 decision_logic_.reset(DecisionLogic::Create(
2080 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2104 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2081 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2105 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2082 tick_timer_.get())); 2106 tick_timer_.get()));
2083 } 2107 }
2084 } // namespace webrtc 2108 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/decision_logic.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698