Fix heap-use-after-free in WebRtcVideoEngine2.
Found in libjingle_peerconnection_unittest on asan while trying to default-enable WebRtcVideoEngine2. BUG=1788 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/44779004 Cr-Commit-Position: refs/heads/master@{#8808} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8808 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -577,7 +577,10 @@ WebRtcVideoChannel2::WebRtcVideoChannel2(
|
||||
WebRtcVideoEncoderFactory* external_encoder_factory,
|
||||
WebRtcVideoDecoderFactory* external_decoder_factory)
|
||||
: unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
|
||||
voice_channel_(voice_channel),
|
||||
voice_channel_id_(voice_channel != nullptr
|
||||
? static_cast<WebRtcVoiceMediaChannel*>(
|
||||
voice_channel)->voe_channel()
|
||||
: -1),
|
||||
external_encoder_factory_(external_encoder_factory),
|
||||
external_decoder_factory_(external_decoder_factory) {
|
||||
SetDefaultOptions();
|
||||
@ -909,10 +912,9 @@ bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp,
|
||||
// the SSRC of the remote audio channel in order to sync the correct webrtc
|
||||
// VoiceEngine channel. For now sync the first channel in non-conference to
|
||||
// match existing behavior in WebRtcVideoEngine.
|
||||
if (voice_channel_ != NULL && receive_streams_.empty() &&
|
||||
if (voice_channel_id_ != -1 && receive_streams_.empty() &&
|
||||
!options_.conference_mode.GetWithDefaultIfUnset(false)) {
|
||||
config.audio_channel_id =
|
||||
static_cast<WebRtcVoiceMediaChannel*>(voice_channel_)->voe_channel();
|
||||
config.audio_channel_id = voice_channel_id_;
|
||||
}
|
||||
|
||||
receive_streams_[ssrc] =
|
||||
|
@ -485,7 +485,7 @@ class WebRtcVideoChannel2 : public rtc::MessageHandler,
|
||||
Settable<VideoCodecSettings> send_codec_;
|
||||
std::vector<webrtc::RtpExtension> send_rtp_extensions_;
|
||||
|
||||
VoiceMediaChannel* const voice_channel_;
|
||||
const int voice_channel_id_;
|
||||
WebRtcVideoEncoderFactory* const external_encoder_factory_;
|
||||
WebRtcVideoDecoderFactory* const external_decoder_factory_;
|
||||
std::vector<VideoCodecSettings> recv_codecs_;
|
||||
|
@ -323,7 +323,7 @@ class WebRtcMediaChannel : public T, public webrtc::Transport {
|
||||
|
||||
private:
|
||||
E *engine_;
|
||||
int voe_channel_;
|
||||
const int voe_channel_;
|
||||
};
|
||||
|
||||
// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
|
||||
|
Reference in New Issue
Block a user