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 09:35:37 +00:00
Родитель 02224ebfcd
Коммит d117c5de66
1 изменённых файлов: 15 добавлений и 7 удалений

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

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