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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2840833002: Delete media type check in Call::NotifyBweOfReceivedPacket.
Patch Set: Fix/improve voe::Channel destruction race. Created 3 years, 8 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 | « webrtc/call/call.cc ('k') | no next file » | 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 8c9b00179f37c705a4356475d3baaa9aef52da7b..0a5ecb96c3fda5af2b6fdc5b49f1ba2274dcbfbf 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -2711,7 +2711,13 @@ int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) {
}
void Channel::ProcessAndEncodeAudio(const AudioFrame& audio_input) {
- RTC_DCHECK(channel_state_.Get().sending);
+ // TODO(nisse): This is not quite enough to avoid race on
+ // destruction. In case we are preempted after this check, and some
+ // other thread calls ChannelManager::DestroyChannel whch calls
henrika_webrtc 2017/04/26 14:16:01 nit, which Also, in your failing test, why did yo
+ // StopSend, StopSend's flush task gets posted *before* we post our
+ // task, our task can get run at the same time as the destructor.
the sun 2017/04/26 20:29:03 Can we use ChannelOwner to allow the task to keep
+ if (!channel_state_.Get().sending)
+ return;
std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
// TODO(henrika): try to avoid copying by moving ownership of audio frame
// either into pool of frames or into the task itself.
@@ -2725,7 +2731,8 @@ void Channel::ProcessAndEncodeAudio(const int16_t* audio_data,
int sample_rate,
size_t number_of_frames,
size_t number_of_channels) {
- RTC_DCHECK(channel_state_.Get().sending);
+ if (!channel_state_.Get().sending)
+ return;
CodecInst codec;
GetSendCodec(codec);
std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
« no previous file with comments | « webrtc/call/call.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698