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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2973083002: TransmitMixer: Check GetSendCodec return value. (Closed)
Patch Set: More checking in channel.cc and added TODOs. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/voice_engine/transmit_mixer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 16122709c31fe976ddde3c63a477d78957f72070..35b63b59c4b1426bf1b5de57e9a893cb2925b13c 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -2759,11 +2759,19 @@ void Channel::ProcessAndEncodeAudio(const int16_t* audio_data,
return;
}
CodecInst codec;
- GetSendCodec(codec);
+ const int result = GetSendCodec(codec);
std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
audio_frame->id_ = ChannelId();
- audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate);
- audio_frame->num_channels_ = std::min(number_of_channels, codec.channels);
+ // TODO(ossu): Investigate how this could happen. b/62909493
+ if (result == 0) {
+ audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate);
+ audio_frame->num_channels_ = std::min(number_of_channels, codec.channels);
+ } else {
+ audio_frame->sample_rate_hz_ = sample_rate;
+ audio_frame->num_channels_ = number_of_channels;
+ LOG(LS_WARNING) << "Unable to get send codec for channel " << ChannelId();
+ RTC_NOTREACHED();
+ }
RemixAndResample(audio_data, number_of_frames, number_of_channels,
sample_rate, &input_resampler_, audio_frame.get());
encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(
« 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