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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 1987143003: Enable muted state by default in VoE (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@muted-connect-voe-mix
Patch Set: Fixing an error with file playing Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame, 489 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame,
490 &muted) == -1) { 490 &muted) == -1) {
491 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), 491 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
492 "Channel::GetAudioFrame() PlayoutData10Ms() failed!"); 492 "Channel::GetAudioFrame() PlayoutData10Ms() failed!");
493 // In all likelihood, the audio in this frame is garbage. We return an 493 // In all likelihood, the audio in this frame is garbage. We return an
494 // error so that the audio mixer module doesn't add it to the mix. As 494 // error so that the audio mixer module doesn't add it to the mix. As
495 // a result, it won't be played out and the actions skipped here are 495 // a result, it won't be played out and the actions skipped here are
496 // irrelevant. 496 // irrelevant.
497 return MixerParticipant::AudioFrameInfo::kError; 497 return MixerParticipant::AudioFrameInfo::kError;
498 } 498 }
499 RTC_DCHECK(!muted); 499
500 if (muted) {
501 // TODO(henrik.lundin): We should be able to do better than this. But we
502 // will have to go through all the cases below where the audio samples may
503 // be used, and handle the muted case in some way.
504 audioFrame->Mute();
505 }
500 506
501 if (_RxVadDetection) { 507 if (_RxVadDetection) {
502 UpdateRxVadDetection(*audioFrame); 508 UpdateRxVadDetection(*audioFrame);
503 } 509 }
504 510
505 // Convert module ID to internal VoE channel ID 511 // Convert module ID to internal VoE channel ID
506 audioFrame->id_ = VoEChannelId(audioFrame->id_); 512 audioFrame->id_ = VoEChannelId(audioFrame->id_);
507 // Store speech type for dead-or-alive detection 513 // Store speech type for dead-or-alive detection
508 _outputSpeechType = audioFrame->speech_type_; 514 _outputSpeechType = audioFrame->speech_type_;
509 515
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // action is needed. 566 // action is needed.
561 567
562 // Do the panning operation (the audio frame contains stereo at this 568 // Do the panning operation (the audio frame contains stereo at this
563 // stage) 569 // stage)
564 AudioFrameOperations::Scale(left_pan, right_pan, *audioFrame); 570 AudioFrameOperations::Scale(left_pan, right_pan, *audioFrame);
565 } 571 }
566 572
567 // Mix decoded PCM output with file if file mixing is enabled 573 // Mix decoded PCM output with file if file mixing is enabled
568 if (state.output_file_playing) { 574 if (state.output_file_playing) {
569 MixAudioWithFile(*audioFrame, audioFrame->sample_rate_hz_); 575 MixAudioWithFile(*audioFrame, audioFrame->sample_rate_hz_);
576 muted = false; // We may have added non-zero samples.
570 } 577 }
571 578
572 // External media 579 // External media
573 if (_outputExternalMedia) { 580 if (_outputExternalMedia) {
574 rtc::CritScope cs(&_callbackCritSect); 581 rtc::CritScope cs(&_callbackCritSect);
575 const bool isStereo = (audioFrame->num_channels_ == 2); 582 const bool isStereo = (audioFrame->num_channels_ == 2);
576 if (_outputExternalMediaCallbackPtr) { 583 if (_outputExternalMediaCallbackPtr) {
577 _outputExternalMediaCallbackPtr->Process( 584 _outputExternalMediaCallbackPtr->Process(
578 _channelId, kPlaybackPerChannel, (int16_t*)audioFrame->data_, 585 _channelId, kPlaybackPerChannel, (int16_t*)audioFrame->data_,
579 audioFrame->samples_per_channel_, audioFrame->sample_rate_hz_, 586 audioFrame->samples_per_channel_, audioFrame->sample_rate_hz_,
580 isStereo); 587 isStereo);
581 } 588 }
582 } 589 }
583 590
584 // Record playout if enabled 591 // Record playout if enabled
585 { 592 {
586 rtc::CritScope cs(&_fileCritSect); 593 rtc::CritScope cs(&_fileCritSect);
587 594
588 if (_outputFileRecording && _outputFileRecorderPtr) { 595 if (_outputFileRecording && _outputFileRecorderPtr) {
589 _outputFileRecorderPtr->RecordAudioToFile(*audioFrame); 596 _outputFileRecorderPtr->RecordAudioToFile(*audioFrame);
590 } 597 }
591 } 598 }
592 599
593 // Measure audio level (0-9) 600 // Measure audio level (0-9)
601 // TODO(henrik.lundin) Use the |muted| information here too.
594 _outputAudioLevel.ComputeLevel(*audioFrame); 602 _outputAudioLevel.ComputeLevel(*audioFrame);
595 603
596 if (capture_start_rtp_time_stamp_ < 0 && audioFrame->timestamp_ != 0) { 604 if (capture_start_rtp_time_stamp_ < 0 && audioFrame->timestamp_ != 0) {
597 // The first frame with a valid rtp timestamp. 605 // The first frame with a valid rtp timestamp.
598 capture_start_rtp_time_stamp_ = audioFrame->timestamp_; 606 capture_start_rtp_time_stamp_ = audioFrame->timestamp_;
599 } 607 }
600 608
601 if (capture_start_rtp_time_stamp_ >= 0) { 609 if (capture_start_rtp_time_stamp_ >= 0) {
602 // audioFrame.timestamp_ should be valid from now on. 610 // audioFrame.timestamp_ should be valid from now on.
603 611
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 AudioCodingModule::Config acm_config; 817 AudioCodingModule::Config acm_config;
810 acm_config.id = VoEModuleId(instanceId, channelId); 818 acm_config.id = VoEModuleId(instanceId, channelId);
811 if (config.Get<NetEqCapacityConfig>().enabled) { 819 if (config.Get<NetEqCapacityConfig>().enabled) {
812 // Clamping the buffer capacity at 20 packets. While going lower will 820 // Clamping the buffer capacity at 20 packets. While going lower will
813 // probably work, it makes little sense. 821 // probably work, it makes little sense.
814 acm_config.neteq_config.max_packets_in_buffer = 822 acm_config.neteq_config.max_packets_in_buffer =
815 std::max(20, config.Get<NetEqCapacityConfig>().capacity); 823 std::max(20, config.Get<NetEqCapacityConfig>().capacity);
816 } 824 }
817 acm_config.neteq_config.enable_fast_accelerate = 825 acm_config.neteq_config.enable_fast_accelerate =
818 config.Get<NetEqFastAccelerate>().enabled; 826 config.Get<NetEqFastAccelerate>().enabled;
819 acm_config.neteq_config.enable_muted_state = false; 827 acm_config.neteq_config.enable_muted_state = true;
820 audio_coding_.reset(AudioCodingModule::Create(acm_config)); 828 audio_coding_.reset(AudioCodingModule::Create(acm_config));
821 829
822 _outputAudioLevel.Clear(); 830 _outputAudioLevel.Clear();
823 831
824 RtpRtcp::Configuration configuration; 832 RtpRtcp::Configuration configuration;
825 configuration.audio = true; 833 configuration.audio = true;
826 configuration.outgoing_transport = this; 834 configuration.outgoing_transport = this;
827 configuration.receive_statistics = rtp_receive_statistics_.get(); 835 configuration.receive_statistics = rtp_receive_statistics_.get();
828 configuration.bandwidth_callback = rtcp_observer_.get(); 836 configuration.bandwidth_callback = rtcp_observer_.get();
829 if (pacing_enabled_) { 837 if (pacing_enabled_) {
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 int64_t min_rtt = 0; 3559 int64_t min_rtt = 0;
3552 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3560 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3553 0) { 3561 0) {
3554 return 0; 3562 return 0;
3555 } 3563 }
3556 return rtt; 3564 return rtt;
3557 } 3565 }
3558 3566
3559 } // namespace voe 3567 } // namespace voe
3560 } // namespace webrtc 3568 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698