Bug 1421819: only init Call object when really needed. r?bwc
MozReview-Commit-ID: JVGnsWjP5O6
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -794,16 +794,19 @@ MediaPipelineFactory::GetOrCreateVideoCo
}
bool receiving = aTrack.GetDirection() == sdp::kRecv;
RefPtr<VideoSessionConduit> conduit =
mPCMedia->GetVideoConduit(aTrackPair.mLevel);
if (!conduit) {
+ if (!mPCMedia->mCall) {
+ mPCMedia->mCall = WebRtcCallWrapper::Create();
+ }
conduit = VideoSessionConduit::Create(mPCMedia->mCall);
if (!conduit) {
MOZ_MTLOG(ML_ERROR, "Could not create video conduit");
return NS_ERROR_FAILURE;
}
mPCMedia->AddVideoConduit(aTrackPair.mLevel, conduit);
}
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -57,23 +57,16 @@ namespace mozilla {
using namespace dom;
static const char* pcmLogTag = "PeerConnectionMedia";
#ifdef LOGTAG
#undef LOGTAG
#endif
#define LOGTAG pcmLogTag
-//XXX(pkerr) What about bitrate settings? Going with the defaults for now.
-RefPtr<WebRtcCallWrapper>
-CreateCall()
-{
- return WebRtcCallWrapper::Create();
-}
-
nsresult
PeerConnectionMedia::ReplaceTrack(const std::string& aOldStreamId,
const std::string& aOldTrackId,
MediaStreamTrack& aNewTrack,
const std::string& aNewStreamId,
const std::string& aNewTrackId)
{
RefPtr<LocalSourceStreamInfo> oldInfo(GetLocalStreamById(aOldStreamId));
@@ -426,19 +419,16 @@ nsresult PeerConnectionMedia::Init(const
}
if (NS_FAILED(rv =
mIceCtxHdlr->ctx()->SetResolver(mDNSResolver->AllocateResolver()))) {
CSFLogError(LOGTAG, "%s: Failed to get dns resolver", __FUNCTION__);
return rv;
}
ConnectSignals(mIceCtxHdlr->ctx().get());
- // This webrtc:Call instance will be shared by audio and video media conduits.
- mCall = CreateCall();
-
return NS_OK;
}
void
PeerConnectionMedia::EnsureTransports(const JsepSession& aSession)
{
auto transports = aSession.GetTransports();
for (size_t i = 0; i < transports.size(); ++i) {