Bug 1601034 - Only update the conduit in replaceTrack() if the track source changed between camera and non-camera. r=bwc

Differential Revision: https://phabricator.services.mozilla.com/D56620

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-12-12 21:39:26 +00:00
Родитель d03a022cc6
Коммит af57fdc27d
1 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -1929,14 +1929,22 @@ PeerConnectionImpl::ReplaceTrackNoRenegotiation(TransceiverImpl& aTransceiver,
PrincipalChanged(aWithTrack);
}
if (aTransceiver.IsVideo()) {
// We update the media pipelines here so we can apply different codec
// settings for different sources (e.g. screensharing as opposed to camera.)
// TODO: We should probably only do this if the source has in fact changed.
if (NS_FAILED((rv = mMedia->UpdateMediaPipelines()))) {
CSFLogError(LOGTAG, "Error Updating MediaPipelines");
MediaSourceEnum oldSource = oldSendTrack
? oldSendTrack->GetSource().GetMediaSource()
: MediaSourceEnum::Camera;
MediaSourceEnum newSource = aWithTrack
? aWithTrack->GetSource().GetMediaSource()
: MediaSourceEnum::Camera;
if (oldSource != newSource) {
if (NS_WARN_IF(NS_FAILED(rv = aTransceiver.UpdateConduit()))) {
CSFLogError(LOGTAG, "Error Updating VideoConduit");
return rv;
}
}
}
return NS_OK;
}