Commit 81fe9724 authored by Henrik Boström's avatar Henrik Boström Committed by Commit Bot

Don't fire ontrack if flag used by RTCTrackEvent is disabled.

It turned out that without making this event dispatching conditional on
the flag it would fire anyway.

It only fires if you listen to the event using addEventListener('track',
X), not if you use ontrack = X. When it fires and the flag is off it
looks like RTCTrackEvent members such as track and streams are undefined
because RTCTrackEvent is behind flag.

With this change you get the expected behavior with and without the flag
enabled.

Also fixes https://github.com/webrtc/apprtc/issues/481

Bug: 761612
Change-Id: Ideaf636633821b0bd9718ef0d2a7a8e7e8b289c1
Reviewed-on: https://chromium-review.googlesource.com/663259Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501325}
parent 87ca26a5
......@@ -1483,8 +1483,10 @@ void RTCPeerConnection::DidAddRemoteStream(
}
RTCRtpReceiver* track_rtp_receiver =
GetOrCreateRTCRtpReceiver(std::move(track_web_rtp_receiver));
ScheduleDispatchEvent(
new RTCTrackEvent(track_rtp_receiver, track, streams));
if (RuntimeEnabledFeatures::RTCRtpSenderEnabled()) {
ScheduleDispatchEvent(
new RTCTrackEvent(track_rtp_receiver, track, streams));
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment