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

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

Issue 2973083002: TransmitMixer: Check GetSendCodec return value. (Closed)
Patch Set: Add DCHECKs on the result of GetSendCodec. 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 | webrtc/voice_engine/transmit_mixer.cc » ('j') | 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 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data, 2752 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data,
2753 int sample_rate, 2753 int sample_rate,
2754 size_t number_of_frames, 2754 size_t number_of_frames,
2755 size_t number_of_channels) { 2755 size_t number_of_channels) {
2756 // Avoid posting as new task if sending was already stopped in StopSend(). 2756 // Avoid posting as new task if sending was already stopped in StopSend().
2757 rtc::CritScope cs(&encoder_queue_lock_); 2757 rtc::CritScope cs(&encoder_queue_lock_);
2758 if (!encoder_queue_is_active_) { 2758 if (!encoder_queue_is_active_) {
2759 return; 2759 return;
2760 } 2760 }
2761 CodecInst codec; 2761 CodecInst codec;
2762 GetSendCodec(codec); 2762 const int result = GetSendCodec(codec);
minyue-webrtc 2017/07/11 11:18:09 will this be safe enough in release build?
ossu 2017/07/11 12:15:10 Not sure. Added a fallback route in case this retu
2763 RTC_DCHECK_EQ(result, 0);
2763 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame()); 2764 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
2764 audio_frame->id_ = ChannelId(); 2765 audio_frame->id_ = ChannelId();
2765 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate); 2766 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate);
2766 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels); 2767 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels);
2767 RemixAndResample(audio_data, number_of_frames, number_of_channels, 2768 RemixAndResample(audio_data, number_of_frames, number_of_channels,
2768 sample_rate, &input_resampler_, audio_frame.get()); 2769 sample_rate, &input_resampler_, audio_frame.get());
2769 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>( 2770 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(
2770 new ProcessAndEncodeAudioTask(std::move(audio_frame), this))); 2771 new ProcessAndEncodeAudioTask(std::move(audio_frame), this)));
2771 } 2772 }
2772 2773
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 int64_t min_rtt = 0; 3141 int64_t min_rtt = 0;
3141 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3142 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3142 0) { 3143 0) {
3143 return 0; 3144 return 0;
3144 } 3145 }
3145 return rtt; 3146 return rtt;
3146 } 3147 }
3147 3148
3148 } // namespace voe 3149 } // namespace voe
3149 } // namespace webrtc 3150 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/voice_engine/transmit_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698