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

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

Issue 2973083002: TransmitMixer: Check GetSendCodec return value. (Closed)
Patch Set: Created 3 years, 5 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 void TransmitMixer::GetSendCodecInfo(int* max_sample_rate, 241 void TransmitMixer::GetSendCodecInfo(int* max_sample_rate,
242 size_t* max_channels) { 242 size_t* max_channels) {
243 *max_sample_rate = 8000; 243 *max_sample_rate = 8000;
244 *max_channels = 1; 244 *max_channels = 1;
245 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid(); 245 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
246 it.Increment()) { 246 it.Increment()) {
247 Channel* channel = it.GetChannel(); 247 Channel* channel = it.GetChannel();
248 if (channel->Sending()) { 248 if (channel->Sending()) {
249 CodecInst codec; 249 CodecInst codec;
250 channel->GetSendCodec(codec); 250 if (channel->GetSendCodec(codec) == 0) {
minyue-webrtc 2017/07/10 09:30:32 I found another usage of this, should that be take
ossu 2017/07/11 10:23:11 We could add a DCHECK there. From what I can see,
251 *max_sample_rate = std::max(*max_sample_rate, codec.plfreq); 251 *max_sample_rate = std::max(*max_sample_rate, codec.plfreq);
252 *max_channels = std::max(*max_channels, codec.channels); 252 *max_channels = std::max(*max_channels, codec.channels);
253 } else {
254 LOG(LS_WARNING) << "Unable to get send codec for channel "
minyue-webrtc 2017/07/10 09:30:32 If I understand correctly, this is not supposed to
ossu 2017/07/11 10:23:11 NOTREACHED after the logging, I presume? So we'll
255 << channel->ChannelId();
256 }
253 } 257 }
254 } 258 }
255 } 259 }
256 260
257 int32_t 261 int32_t
258 TransmitMixer::PrepareDemux(const void* audioSamples, 262 TransmitMixer::PrepareDemux(const void* audioSamples,
259 size_t nSamples, 263 size_t nSamples,
260 size_t nChannels, 264 size_t nChannels,
261 uint32_t samplesPerSec, 265 uint32_t samplesPerSec,
262 uint16_t totalDelayMS, 266 uint16_t totalDelayMS,
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { 1020 void TransmitMixer::EnableStereoChannelSwapping(bool enable) {
1017 swap_stereo_channels_ = enable; 1021 swap_stereo_channels_ = enable;
1018 } 1022 }
1019 1023
1020 bool TransmitMixer::IsStereoChannelSwappingEnabled() { 1024 bool TransmitMixer::IsStereoChannelSwappingEnabled() {
1021 return swap_stereo_channels_; 1025 return swap_stereo_channels_;
1022 } 1026 }
1023 1027
1024 } // namespace voe 1028 } // namespace voe
1025 } // namespace webrtc 1029 } // 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