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

Side by Side Diff: webrtc/modules/utility/source/coder.cc

Issue 1985743002: Propagate muted parameter to VoE::Channel (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Resurrect the PlayoutData10Ms(int, AudioFrame*) method 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
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/common_types.h" 11 #include "webrtc/common_types.h"
12 #include "webrtc/modules/include/module_common_types.h" 12 #include "webrtc/modules/include/module_common_types.h"
13 #include "webrtc/modules/utility/source/coder.h" 13 #include "webrtc/modules/utility/source/coder.h"
14 14
15 namespace webrtc { 15 namespace webrtc {
16 namespace {
17 AudioCodingModule::Config GetAcmConfig(uint32_t id) {
18 AudioCodingModule::Config config;
19 // This class does not handle muted output.
20 config.neteq_config.enable_muted_state = false;
21 config.id = id;
22 return config;
23 }
24 } // namespace
16 25
17 AudioCoder::AudioCoder(uint32_t instance_id) 26 AudioCoder::AudioCoder(uint32_t instance_id)
18 : acm_(AudioCodingModule::Create(instance_id)), 27 : acm_(AudioCodingModule::Create(GetAcmConfig(instance_id))),
19 receive_codec_(), 28 receive_codec_(),
20 encode_timestamp_(0), 29 encode_timestamp_(0),
21 encoded_data_(nullptr), 30 encoded_data_(nullptr),
22 encoded_length_in_bytes_(0), 31 encoded_length_in_bytes_(0),
23 decode_timestamp_(0) { 32 decode_timestamp_(0) {
24 acm_->InitializeReceiver(); 33 acm_->InitializeReceiver();
25 acm_->RegisterTransportCallback(this); 34 acm_->RegisterTransportCallback(this);
26 } 35 }
27 36
28 AudioCoder::~AudioCoder() {} 37 AudioCoder::~AudioCoder() {}
(...skipping 18 matching lines...) Expand all
47 const int8_t* incoming_payload, 56 const int8_t* incoming_payload,
48 size_t payload_length) { 57 size_t payload_length) {
49 if (payload_length > 0) { 58 if (payload_length > 0) {
50 const uint8_t payload_type = receive_codec_.pltype; 59 const uint8_t payload_type = receive_codec_.pltype;
51 decode_timestamp_ += receive_codec_.pacsize; 60 decode_timestamp_ += receive_codec_.pacsize;
52 if (acm_->IncomingPayload((const uint8_t*)incoming_payload, payload_length, 61 if (acm_->IncomingPayload((const uint8_t*)incoming_payload, payload_length,
53 payload_type, decode_timestamp_) == -1) { 62 payload_type, decode_timestamp_) == -1) {
54 return -1; 63 return -1;
55 } 64 }
56 } 65 }
57 return acm_->PlayoutData10Ms((uint16_t)samp_freq_hz, &decoded_audio); 66 bool muted;
67 int32_t ret =
68 acm_->PlayoutData10Ms((uint16_t)samp_freq_hz, &decoded_audio, &muted);
69 RTC_DCHECK(!muted);
70 return ret;
58 } 71 }
59 72
60 int32_t AudioCoder::PlayoutData(AudioFrame& decoded_audio, 73 int32_t AudioCoder::PlayoutData(AudioFrame& decoded_audio,
61 uint16_t& samp_freq_hz) { 74 uint16_t& samp_freq_hz) {
62 return acm_->PlayoutData10Ms(samp_freq_hz, &decoded_audio); 75 bool muted;
76 int32_t ret = acm_->PlayoutData10Ms(samp_freq_hz, &decoded_audio, &muted);
77 RTC_DCHECK(!muted);
78 return ret;
63 } 79 }
64 80
65 int32_t AudioCoder::Encode(const AudioFrame& audio, 81 int32_t AudioCoder::Encode(const AudioFrame& audio,
66 int8_t* encoded_data, 82 int8_t* encoded_data,
67 size_t& encoded_length_in_bytes) { 83 size_t& encoded_length_in_bytes) {
68 // Fake a timestamp in case audio doesn't contain a correct timestamp. 84 // Fake a timestamp in case audio doesn't contain a correct timestamp.
69 // Make a local copy of the audio frame since audio is const 85 // Make a local copy of the audio frame since audio is const
70 AudioFrame audio_frame; 86 AudioFrame audio_frame;
71 audio_frame.CopyFrom(audio); 87 audio_frame.CopyFrom(audio);
72 audio_frame.timestamp_ = encode_timestamp_; 88 audio_frame.timestamp_ = encode_timestamp_;
(...skipping 15 matching lines...) Expand all
88 uint32_t /* time_stamp */, 104 uint32_t /* time_stamp */,
89 const uint8_t* payload_data, 105 const uint8_t* payload_data,
90 size_t payload_size, 106 size_t payload_size,
91 const RTPFragmentationHeader* /* fragmentation*/) { 107 const RTPFragmentationHeader* /* fragmentation*/) {
92 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); 108 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size);
93 encoded_length_in_bytes_ = payload_size; 109 encoded_length_in_bytes_ = payload_size;
94 return 0; 110 return 0;
95 } 111 }
96 112
97 } // namespace webrtc 113 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/test/target_delay_unittest.cc ('k') | webrtc/voice_engine/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698