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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « webrtc/call/call.cc ('k') | 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 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 else 2704 else
2705 audio_coding_->DisableNack(); 2705 audio_coding_->DisableNack();
2706 } 2706 }
2707 2707
2708 // Called when we are missing one or more packets. 2708 // Called when we are missing one or more packets.
2709 int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { 2709 int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) {
2710 return _rtpRtcpModule->SendNACK(sequence_numbers, length); 2710 return _rtpRtcpModule->SendNACK(sequence_numbers, length);
2711 } 2711 }
2712 2712
2713 void Channel::ProcessAndEncodeAudio(const AudioFrame& audio_input) { 2713 void Channel::ProcessAndEncodeAudio(const AudioFrame& audio_input) {
2714 RTC_DCHECK(channel_state_.Get().sending); 2714 // TODO(nisse): This is not quite enough to avoid race on
2715 // destruction. In case we are preempted after this check, and some
2716 // 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
2717 // StopSend, StopSend's flush task gets posted *before* we post our
2718 // 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
2719 if (!channel_state_.Get().sending)
2720 return;
2715 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame()); 2721 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
2716 // TODO(henrika): try to avoid copying by moving ownership of audio frame 2722 // TODO(henrika): try to avoid copying by moving ownership of audio frame
2717 // either into pool of frames or into the task itself. 2723 // either into pool of frames or into the task itself.
2718 audio_frame->CopyFrom(audio_input); 2724 audio_frame->CopyFrom(audio_input);
2719 audio_frame->id_ = ChannelId(); 2725 audio_frame->id_ = ChannelId();
2720 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>( 2726 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(
2721 new ProcessAndEncodeAudioTask(std::move(audio_frame), this))); 2727 new ProcessAndEncodeAudioTask(std::move(audio_frame), this)));
2722 } 2728 }
2723 2729
2724 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data, 2730 void Channel::ProcessAndEncodeAudio(const int16_t* audio_data,
2725 int sample_rate, 2731 int sample_rate,
2726 size_t number_of_frames, 2732 size_t number_of_frames,
2727 size_t number_of_channels) { 2733 size_t number_of_channels) {
2728 RTC_DCHECK(channel_state_.Get().sending); 2734 if (!channel_state_.Get().sending)
2735 return;
2729 CodecInst codec; 2736 CodecInst codec;
2730 GetSendCodec(codec); 2737 GetSendCodec(codec);
2731 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame()); 2738 std::unique_ptr<AudioFrame> audio_frame(new AudioFrame());
2732 audio_frame->id_ = ChannelId(); 2739 audio_frame->id_ = ChannelId();
2733 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate); 2740 audio_frame->sample_rate_hz_ = std::min(codec.plfreq, sample_rate);
2734 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels); 2741 audio_frame->num_channels_ = std::min(number_of_channels, codec.channels);
2735 RemixAndResample(audio_data, number_of_frames, number_of_channels, 2742 RemixAndResample(audio_data, number_of_frames, number_of_channels,
2736 sample_rate, &input_resampler_, audio_frame.get()); 2743 sample_rate, &input_resampler_, audio_frame.get());
2737 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>( 2744 encoder_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(
2738 new ProcessAndEncodeAudioTask(std::move(audio_frame), this))); 2745 new ProcessAndEncodeAudioTask(std::move(audio_frame), this)));
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 int64_t min_rtt = 0; 3115 int64_t min_rtt = 0;
3109 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3116 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3110 0) { 3117 0) {
3111 return 0; 3118 return 0;
3112 } 3119 }
3113 return rtt; 3120 return rtt;
3114 } 3121 }
3115 3122
3116 } // namespace voe 3123 } // namespace voe
3117 } // namespace webrtc 3124 } // namespace webrtc
OLDNEW
« 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