mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1531803 - Part 2: Get rid of JsepTrack::GetTrackId (since it doesn't mean anything), and re-focus on stream ids. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D25795 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9ab4878c40
commit
ef7c16372d
@ -216,10 +216,10 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
|
||||
RefPtr<JsepTransceiver>& transceiver(side.GetTransceivers()[index]);
|
||||
JsepTrack& track = transceiver->mSendTrack;
|
||||
EXPECT_FALSE(track.GetTrackId().empty()) << "No track at index " << index;
|
||||
EXPECT_FALSE(track.GetStreamIds().empty()) << "No track at index " << index;
|
||||
|
||||
JsepTrack original(track);
|
||||
track.ClearTrackIds();
|
||||
track.ClearStreamIds();
|
||||
transceiver->mJsDirection &= SdpDirectionAttribute::Direction::kRecvonly;
|
||||
return original;
|
||||
}
|
||||
@ -324,8 +324,8 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
}
|
||||
transceivers[i]->mJsDirection |=
|
||||
SdpDirectionAttribute::Direction::kSendonly;
|
||||
transceivers[i]->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, stream_id), track_id);
|
||||
transceivers[i]->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, stream_id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -576,10 +576,6 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t1.GetTrackId() != t2.GetTrackId()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t1.GetActive() != t2.GetActive()) {
|
||||
return false;
|
||||
}
|
||||
@ -793,8 +789,6 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
if (track.GetMediaType() != SdpMediaSection::kApplication) {
|
||||
std::string msidAttr("a=msid:");
|
||||
msidAttr += track.GetStreamIds()[0];
|
||||
msidAttr += " ";
|
||||
msidAttr += track.GetTrackId();
|
||||
ASSERT_NE(std::string::npos, offer.find(msidAttr))
|
||||
<< "Did not find " << msidAttr << " in offer";
|
||||
}
|
||||
@ -877,8 +871,6 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
if (recvTrack.GetMediaType() != SdpMediaSection::kApplication) {
|
||||
std::string msidAttr("a=msid:");
|
||||
msidAttr += sendTrack.GetStreamIds()[0];
|
||||
msidAttr += " ";
|
||||
msidAttr += sendTrack.GetTrackId();
|
||||
ASSERT_NE(std::string::npos, answer.find(msidAttr))
|
||||
<< "Did not find " << msidAttr << " in answer";
|
||||
}
|
||||
@ -1302,8 +1294,7 @@ class JsepSessionTest : public JsepSessionTestBase,
|
||||
|
||||
void DumpTrack(const JsepTrack& track) {
|
||||
const JsepTrackNegotiatedDetails* details = track.GetNegotiatedDetails();
|
||||
std::cerr << " type=" << track.GetMediaType()
|
||||
<< " track-id=" << track.GetTrackId() << std::endl;
|
||||
std::cerr << " type=" << track.GetMediaType() << std::endl;
|
||||
if (!details) {
|
||||
std::cerr << " not negotiated" << std::endl;
|
||||
return;
|
||||
@ -1807,9 +1798,7 @@ TEST_P(JsepSessionTest, RenegotiationBothAddTracksToExistingStream) {
|
||||
}
|
||||
|
||||
// The JSEP draft explicitly forbids changing the msid on an m-section, but
|
||||
// that is a new restriction that older versions of Firefox do not follow.
|
||||
// JS will not see the msid change, since that is filtered out (except for
|
||||
// RTCRtpTransceiver.remoteTrackId)
|
||||
// that is a bug.
|
||||
TEST_P(JsepSessionTest, RenegotiationOffererChangesMsid) {
|
||||
AddTracks(*mSessionOff);
|
||||
AddTracks(*mSessionAns);
|
||||
@ -1826,14 +1815,11 @@ TEST_P(JsepSessionTest, RenegotiationOffererChangesMsid) {
|
||||
return;
|
||||
}
|
||||
std::string streamId = transceiver->mSendTrack.GetStreamIds()[0];
|
||||
std::string trackId = transceiver->mSendTrack.GetTrackId();
|
||||
std::string msidToReplace("a=msid:");
|
||||
msidToReplace += streamId;
|
||||
msidToReplace += " ";
|
||||
msidToReplace += trackId;
|
||||
size_t msidOffset = offer.find(msidToReplace);
|
||||
ASSERT_NE(std::string::npos, msidOffset);
|
||||
offer.replace(msidOffset, msidToReplace.size(), "a=msid:foo bar");
|
||||
offer.replace(msidOffset, msidToReplace.size(), "a=msid:foo");
|
||||
|
||||
SetRemoteOffer(offer);
|
||||
transceiver = GetNegotiatedTransceiver(*mSessionAns, 0);
|
||||
@ -1845,7 +1831,7 @@ TEST_P(JsepSessionTest, RenegotiationOffererChangesMsid) {
|
||||
}
|
||||
|
||||
// The JSEP draft explicitly forbids changing the msid on an m-section, but
|
||||
// that is a new restriction that older versions of Firefox do not follow.
|
||||
// that is a bug.
|
||||
TEST_P(JsepSessionTest, RenegotiationAnswererChangesMsid) {
|
||||
AddTracks(*mSessionOff);
|
||||
AddTracks(*mSessionAns);
|
||||
@ -1871,14 +1857,11 @@ TEST_P(JsepSessionTest, RenegotiationAnswererChangesMsid) {
|
||||
return;
|
||||
}
|
||||
std::string streamId = transceiver->mSendTrack.GetStreamIds()[0];
|
||||
std::string trackId = transceiver->mSendTrack.GetTrackId();
|
||||
std::string msidToReplace("a=msid:");
|
||||
msidToReplace += streamId;
|
||||
msidToReplace += " ";
|
||||
msidToReplace += trackId;
|
||||
size_t msidOffset = answer.find(msidToReplace);
|
||||
ASSERT_NE(std::string::npos, msidOffset);
|
||||
answer.replace(msidOffset, msidToReplace.size(), "a=msid:foo bar");
|
||||
answer.replace(msidOffset, msidToReplace.size(), "a=msid:foo");
|
||||
|
||||
SetRemoteAnswer(answer);
|
||||
|
||||
@ -2121,7 +2104,7 @@ TEST_P(JsepSessionTest, RenegotiationBothStopTransceiverDifferentMsection) {
|
||||
ASSERT_TRUE(mSessionAns->GetTransceivers()[1]->IsStopped());
|
||||
}
|
||||
|
||||
TEST_P(JsepSessionTest, RenegotiationOffererReplacesTrack) {
|
||||
TEST_P(JsepSessionTest, RenegotiationOffererChangesStreamId) {
|
||||
AddTracks(*mSessionOff);
|
||||
AddTracks(*mSessionAns);
|
||||
|
||||
@ -2132,20 +2115,16 @@ TEST_P(JsepSessionTest, RenegotiationOffererReplacesTrack) {
|
||||
|
||||
OfferAnswer();
|
||||
|
||||
mSessionOff->GetTransceivers()[0]->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "newstream"), "newtrack");
|
||||
mSessionOff->GetTransceivers()[0]->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "newstream"));
|
||||
|
||||
OfferAnswer(CHECK_SUCCESS);
|
||||
|
||||
// Latest JSEP spec says the msid never changes, so the other side will not
|
||||
// notice track replacement.
|
||||
ASSERT_NE("newtrack",
|
||||
mSessionAns->GetTransceivers()[0]->mRecvTrack.GetTrackId());
|
||||
ASSERT_NE("newstream",
|
||||
ASSERT_EQ("newstream",
|
||||
mSessionAns->GetTransceivers()[0]->mRecvTrack.GetStreamIds()[0]);
|
||||
}
|
||||
|
||||
TEST_P(JsepSessionTest, RenegotiationAnswererReplacesTrack) {
|
||||
TEST_P(JsepSessionTest, RenegotiationAnswererChangesStreamId) {
|
||||
AddTracks(*mSessionOff);
|
||||
AddTracks(*mSessionAns);
|
||||
|
||||
@ -2156,16 +2135,12 @@ TEST_P(JsepSessionTest, RenegotiationAnswererReplacesTrack) {
|
||||
|
||||
OfferAnswer();
|
||||
|
||||
mSessionAns->GetTransceivers()[0]->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "newstream"), "newtrack");
|
||||
mSessionAns->GetTransceivers()[0]->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "newstream"));
|
||||
|
||||
OfferAnswer(CHECK_SUCCESS);
|
||||
|
||||
// Latest JSEP spec says the msid never changes, so the other side will not
|
||||
// notice track replacement.
|
||||
ASSERT_NE("newtrack",
|
||||
mSessionOff->GetTransceivers()[0]->mRecvTrack.GetTrackId());
|
||||
ASSERT_NE("newstream",
|
||||
ASSERT_EQ("newstream",
|
||||
mSessionOff->GetTransceivers()[0]->mRecvTrack.GetStreamIds()[0]);
|
||||
}
|
||||
|
||||
@ -2196,8 +2171,6 @@ TEST_P(JsepSessionTest, RenegotiationAutoAssignedMsidIsStable) {
|
||||
// These should not match since we've monkeyed with the msid
|
||||
ASSERT_NE(origOffererTransceivers[i]->mRecvTrack.GetStreamIds(),
|
||||
origAnswererTransceivers[i]->mSendTrack.GetStreamIds());
|
||||
ASSERT_NE(origOffererTransceivers[i]->mRecvTrack.GetTrackId(),
|
||||
origAnswererTransceivers[i]->mSendTrack.GetTrackId());
|
||||
}
|
||||
|
||||
offer = CreateOffer();
|
||||
@ -2363,7 +2336,26 @@ TEST_P(JsepSessionTest, RenegotiationAnswererDisablesMsid) {
|
||||
|
||||
auto newOffererTransceivers = mSessionOff->GetTransceivers();
|
||||
|
||||
ASSERT_TRUE(Equals(origOffererTransceivers, newOffererTransceivers));
|
||||
ASSERT_EQ(origOffererTransceivers.size(), newOffererTransceivers.size());
|
||||
for (size_t i = 0; i < origOffererTransceivers.size(); ++i) {
|
||||
ASSERT_EQ(origOffererTransceivers[i]->mRecvTrack.GetMediaType(),
|
||||
newOffererTransceivers[i]->mRecvTrack.GetMediaType());
|
||||
|
||||
ASSERT_TRUE(Equals(origOffererTransceivers[i]->mSendTrack,
|
||||
newOffererTransceivers[i]->mSendTrack));
|
||||
ASSERT_TRUE(Equals(origOffererTransceivers[i]->mTransport,
|
||||
newOffererTransceivers[i]->mTransport));
|
||||
|
||||
if (origOffererTransceivers[i]->mRecvTrack.GetMediaType() ==
|
||||
SdpMediaSection::kApplication) {
|
||||
ASSERT_TRUE(Equals(origOffererTransceivers[i]->mRecvTrack,
|
||||
newOffererTransceivers[i]->mRecvTrack));
|
||||
} else {
|
||||
// This should be the only difference
|
||||
ASSERT_FALSE(Equals(origOffererTransceivers[i]->mRecvTrack,
|
||||
newOffererTransceivers[i]->mRecvTrack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests behavior when offerer does not use bundle on the initial offer/answer,
|
||||
@ -3152,13 +3144,13 @@ TEST_F(JsepSessionTest, OfferToReceiveVideoNotUsed) {
|
||||
|
||||
TEST_F(JsepSessionTest, CreateOfferNoDatachannelDefault) {
|
||||
RefPtr<JsepTransceiver> audio(new JsepTransceiver(SdpMediaSection::kAudio));
|
||||
audio->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "a1");
|
||||
audio->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(audio);
|
||||
|
||||
RefPtr<JsepTransceiver> video(new JsepTransceiver(SdpMediaSection::kVideo));
|
||||
video->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "v1");
|
||||
video->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(video);
|
||||
|
||||
std::string offer = CreateOffer();
|
||||
@ -3178,13 +3170,13 @@ TEST_F(JsepSessionTest, ValidateOfferedVideoCodecParams) {
|
||||
types.push_back(SdpMediaSection::kVideo);
|
||||
|
||||
RefPtr<JsepTransceiver> audio(new JsepTransceiver(SdpMediaSection::kAudio));
|
||||
audio->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "a1");
|
||||
audio->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(audio);
|
||||
|
||||
RefPtr<JsepTransceiver> video(new JsepTransceiver(SdpMediaSection::kVideo));
|
||||
video->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "v1");
|
||||
video->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(video);
|
||||
|
||||
std::string offer = CreateOffer();
|
||||
@ -3307,13 +3299,13 @@ TEST_F(JsepSessionTest, ValidateOfferedAudioCodecParams) {
|
||||
types.push_back(SdpMediaSection::kVideo);
|
||||
|
||||
RefPtr<JsepTransceiver> audio(new JsepTransceiver(SdpMediaSection::kAudio));
|
||||
audio->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "a1");
|
||||
audio->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(audio);
|
||||
|
||||
RefPtr<JsepTransceiver> video(new JsepTransceiver(SdpMediaSection::kVideo));
|
||||
video->mSendTrack.UpdateTrackIds(
|
||||
std::vector<std::string>(1, "offerer_stream"), "v1");
|
||||
video->mSendTrack.UpdateStreamIds(
|
||||
std::vector<std::string>(1, "offerer_stream"));
|
||||
mSessionOff->AddTransceiver(video);
|
||||
|
||||
std::string offer = CreateOffer();
|
||||
@ -6117,7 +6109,7 @@ TEST_F(JsepSessionTest, AddTrackMagicWithNullReplaceTrack) {
|
||||
|
||||
// Ok, transceiver 2 is "magical". Ensure it still has this "magical"
|
||||
// auto-matching property even if we null it out with replaceTrack.
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.ClearTrackIds();
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.ClearStreamIds();
|
||||
mSessionAns->GetTransceivers()[2]->mJsDirection =
|
||||
SdpDirectionAttribute::Direction::kRecvonly;
|
||||
|
||||
@ -6164,8 +6156,7 @@ TEST_F(JsepSessionTest, NoAddTrackMagicReplaceTrack) {
|
||||
mSessionAns->AddTransceiver(
|
||||
new JsepTransceiver(SdpMediaSection::MediaType::kAudio));
|
||||
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.UpdateTrackIds({"newstream"},
|
||||
"newtrack");
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.UpdateStreamIds({"newstream"});
|
||||
|
||||
ASSERT_EQ(3U, mSessionAns->GetTransceivers().size());
|
||||
ASSERT_EQ(0U, mSessionAns->GetTransceivers()[0]->GetLevel());
|
||||
@ -6305,7 +6296,7 @@ TEST_F(JsepSessionTest, ComplicatedRemoteRollback) {
|
||||
// with replaceTrack.
|
||||
AddTracks(*mSessionAns, "audio");
|
||||
ASSERT_TRUE(mSessionAns->GetTransceivers()[2]->HasAddTrackMagic());
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.ClearTrackIds();
|
||||
mSessionAns->GetTransceivers()[2]->mSendTrack.ClearStreamIds();
|
||||
mSessionAns->GetTransceivers()[2]->mJsDirection =
|
||||
SdpDirectionAttribute::Direction::kRecvonly;
|
||||
|
||||
@ -6314,8 +6305,7 @@ TEST_F(JsepSessionTest, ComplicatedRemoteRollback) {
|
||||
|
||||
// This will not cause the third audio transceiver to stick around; having a
|
||||
// track is _not_ enough to preserve it. It must have addTrack "magic"!
|
||||
mSessionAns->GetTransceivers()[4]->mSendTrack.UpdateTrackIds({"newstream"},
|
||||
"newtrack");
|
||||
mSessionAns->GetTransceivers()[4]->mSendTrack.UpdateStreamIds({"newstream"});
|
||||
|
||||
// Create a fourth audio transceiver. Rollback will leave it alone, since we
|
||||
// created it.
|
||||
|
@ -87,8 +87,7 @@ class JsepTrackTest : public ::testing::Test {
|
||||
void InitTracks(SdpMediaSection::MediaType type) {
|
||||
mSendOff = JsepTrack(type, sdp::kSend);
|
||||
if (type != SdpMediaSection::MediaType::kApplication) {
|
||||
mSendOff.UpdateTrackIds(std::vector<std::string>(1, "stream_id"),
|
||||
"track_id");
|
||||
mSendOff.UpdateStreamIds(std::vector<std::string>(1, "stream_id"));
|
||||
}
|
||||
mRecvOff = JsepTrack(type, sdp::kRecv);
|
||||
mSendOff.PopulateCodecs(mOffCodecs);
|
||||
@ -96,8 +95,7 @@ class JsepTrackTest : public ::testing::Test {
|
||||
|
||||
mSendAns = JsepTrack(type, sdp::kSend);
|
||||
if (type != SdpMediaSection::MediaType::kApplication) {
|
||||
mSendAns.UpdateTrackIds(std::vector<std::string>(1, "stream_id"),
|
||||
"track_id");
|
||||
mSendAns.UpdateStreamIds(std::vector<std::string>(1, "stream_id"));
|
||||
}
|
||||
mRecvAns = JsepTrack(type, sdp::kRecv);
|
||||
mSendAns.PopulateCodecs(mAnsCodecs);
|
||||
@ -182,11 +180,11 @@ class JsepTrackTest : public ::testing::Test {
|
||||
ASSERT_TRUE(recv.GetNegotiatedDetails());
|
||||
}
|
||||
|
||||
if (!send.GetTrackId().empty() && send.GetNegotiatedDetails()) {
|
||||
if (!send.GetStreamIds().empty() && send.GetNegotiatedDetails()) {
|
||||
ASSERT_EQ(expected, send.GetNegotiatedDetails()->GetEncodingCount());
|
||||
}
|
||||
|
||||
if (!recv.GetTrackId().empty() && recv.GetNegotiatedDetails()) {
|
||||
if (!recv.GetStreamIds().empty() && recv.GetNegotiatedDetails()) {
|
||||
ASSERT_EQ(expected, recv.GetNegotiatedDetails()->GetEncodingCount());
|
||||
}
|
||||
}
|
||||
@ -385,8 +383,7 @@ TEST_F(JsepTrackTest, CheckForMismatchedAudioCodecAndVideoTrack) {
|
||||
// make codecs including telephone-event (an audio codec)
|
||||
offerCodecs = MakeCodecs(false, false, true);
|
||||
JsepTrack videoTrack(SdpMediaSection::kVideo, sdp::kSend);
|
||||
videoTrack.UpdateTrackIds(std::vector<std::string>(1, "stream_id"),
|
||||
"track_id");
|
||||
videoTrack.UpdateStreamIds(std::vector<std::string>(1, "stream_id"));
|
||||
// populate codecs and then make sure we don't have any audio codecs
|
||||
// in the video track
|
||||
videoTrack.PopulateCodecs(offerCodecs);
|
||||
|
@ -189,12 +189,12 @@ class JsepSession {
|
||||
memset(sending, 0, sizeof(sending));
|
||||
|
||||
for (const auto& transceiver : GetTransceivers()) {
|
||||
if (!transceiver->mRecvTrack.GetTrackId().empty() ||
|
||||
if (!transceiver->mRecvTrack.GetActive() ||
|
||||
transceiver->GetMediaType() == SdpMediaSection::kApplication) {
|
||||
receiving[transceiver->mRecvTrack.GetMediaType()]++;
|
||||
}
|
||||
|
||||
if (!transceiver->mSendTrack.GetTrackId().empty() ||
|
||||
if (!transceiver->mSendTrack.GetActive() ||
|
||||
transceiver->GetMediaType() == SdpMediaSection::kApplication) {
|
||||
sending[transceiver->mSendTrack.GetMediaType()]++;
|
||||
}
|
||||
|
@ -114,8 +114,7 @@ nsresult JsepSessionImpl::AddTransceiver(RefPtr<JsepTransceiver> transceiver) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
transceiver->mSendTrack.UpdateTrackIds(std::vector<std::string>(),
|
||||
trackId);
|
||||
transceiver->mSendTrack.SetTrackId(trackId);
|
||||
}
|
||||
} else {
|
||||
// Datachannel transceivers should always be sendrecv. Just set it instead
|
||||
@ -327,25 +326,6 @@ void JsepSessionImpl::SetupBundle(Sdp* sdp) const {
|
||||
}
|
||||
}
|
||||
|
||||
nsresult JsepSessionImpl::GetRemoteIds(const Sdp& sdp,
|
||||
const SdpMediaSection& msection,
|
||||
std::vector<std::string>* streamIds,
|
||||
std::string* trackId) {
|
||||
// Generate random track ids.
|
||||
if (!mUuidGen->Generate(trackId)) {
|
||||
JSEP_SET_ERROR("Failed to generate UUID for JsepTrack");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv = mSdpHelper.GetIdsFromMsid(sdp, msection, streamIds);
|
||||
if (rv == NS_ERROR_NOT_AVAILABLE) {
|
||||
streamIds->push_back(mDefaultRemoteStreamId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
JsepSession::Result JsepSessionImpl::CreateOffer(
|
||||
const JsepOfferOptions& options, std::string* offer) {
|
||||
mLastError.clear();
|
||||
@ -1485,17 +1465,14 @@ nsresult JsepSessionImpl::UpdateTransceiversFromRemoteDescription(
|
||||
}
|
||||
|
||||
// Interop workaround for endpoints that don't support msid.
|
||||
// Ensures that there is a default track id set.
|
||||
// TODO(bug 1426005): Remove this
|
||||
if (msection.IsSending() && transceiver->mRecvTrack.GetTrackId().empty()) {
|
||||
std::vector<std::string> streamIds;
|
||||
std::string trackId;
|
||||
|
||||
nsresult rv = GetRemoteIds(remote, msection, &streamIds, &trackId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
transceiver->mRecvTrack.UpdateTrackIds(streamIds, trackId);
|
||||
}
|
||||
// Ensures that there is a default stream id set, provided the remote is
|
||||
// sending.
|
||||
// TODO(bug 1426005): Remove this, or at least move it to JsepTrack.
|
||||
transceiver->mRecvTrack.UpdateStreamIds({mDefaultRemoteStreamId});
|
||||
|
||||
// This will process a=msid if present, or clear the stream ids if the
|
||||
// msection is not sending. If the msection is sending, and there are no
|
||||
// a=msid, the previously set default will stay.
|
||||
transceiver->mRecvTrack.UpdateRecvTrack(remote, msection);
|
||||
}
|
||||
|
||||
|
@ -194,9 +194,6 @@ class JsepSessionImpl : public JsepSession {
|
||||
const Sdp& newOffer, Sdp* newLocal);
|
||||
void EnsureMsid(Sdp* remote);
|
||||
void SetupBundle(Sdp* sdp) const;
|
||||
nsresult GetRemoteIds(const Sdp& sdp, const SdpMediaSection& msection,
|
||||
std::vector<std::string>* streamIds,
|
||||
std::string* trackId);
|
||||
nsresult CreateOfferMsection(const JsepOfferOptions& options,
|
||||
JsepTransceiver& transceiver, Sdp* local);
|
||||
nsresult CreateAnswerMsection(const JsepAnswerOptions& options,
|
||||
|
@ -85,16 +85,13 @@ class JsepTrack {
|
||||
|
||||
virtual ~JsepTrack() {}
|
||||
|
||||
void UpdateTrackIds(const std::vector<std::string>& streamIds,
|
||||
const std::string& trackId) {
|
||||
void UpdateStreamIds(const std::vector<std::string>& streamIds) {
|
||||
mStreamIds = streamIds;
|
||||
mTrackId = trackId;
|
||||
}
|
||||
|
||||
void ClearTrackIds() {
|
||||
mStreamIds.clear();
|
||||
mTrackId.clear();
|
||||
}
|
||||
void SetTrackId(const std::string& aTrackId) { mTrackId = aTrackId; }
|
||||
|
||||
void ClearStreamIds() { mStreamIds.clear(); }
|
||||
|
||||
void UpdateRecvTrack(const Sdp& sdp, const SdpMediaSection& msection) {
|
||||
MOZ_ASSERT(mDirection == sdp::kRecv);
|
||||
@ -159,8 +156,6 @@ class JsepTrack {
|
||||
return mStreamIds;
|
||||
}
|
||||
|
||||
virtual const std::string& GetTrackId() const { return mTrackId; }
|
||||
|
||||
virtual const std::string& GetCNAME() const { return mCNAME; }
|
||||
|
||||
virtual void SetCNAME(const std::string& cname) { mCNAME = cname; }
|
||||
|
@ -1422,8 +1422,8 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) {
|
||||
}
|
||||
|
||||
const JsepTrack& receiving(jsepTransceiver->mRecvTrack);
|
||||
CSFLogInfo(LOGTAG, "%s: pc = %s, asking JS to create transceiver for %s",
|
||||
__FUNCTION__, mHandle.c_str(), receiving.GetTrackId().c_str());
|
||||
CSFLogInfo(LOGTAG, "%s: pc = %s, asking JS to create transceiver",
|
||||
__FUNCTION__, mHandle.c_str());
|
||||
switch (receiving.GetMediaType()) {
|
||||
case SdpMediaSection::MediaType::kAudio:
|
||||
mPCObserver->OnTransceiverNeeded(NS_ConvertASCIItoUTF16("audio"),
|
||||
|
@ -388,20 +388,6 @@ void TransceiverImpl::SyncWithJS(dom::RTCRtpTransceiver& aJsTransceiver,
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<dom::MediaStreamTrack> sendTrack = sender->GetTrack(aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string trackId = mJsepTransceiver->mSendTrack.GetTrackId();
|
||||
|
||||
if (sendTrack) {
|
||||
nsString wideTrackId;
|
||||
sendTrack->GetId(wideTrackId);
|
||||
trackId = NS_ConvertUTF16toUTF8(wideTrackId).get();
|
||||
MOZ_ASSERT(!trackId.empty());
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<DOMMediaStream>> streams;
|
||||
sender->GetStreams(streams, aRv);
|
||||
if (aRv.Failed()) {
|
||||
@ -417,7 +403,7 @@ void TransceiverImpl::SyncWithJS(dom::RTCRtpTransceiver& aJsTransceiver,
|
||||
streamIds.push_back(streamId);
|
||||
}
|
||||
|
||||
mJsepTransceiver->mSendTrack.UpdateTrackIds(streamIds, trackId);
|
||||
mJsepTransceiver->mSendTrack.UpdateStreamIds(streamIds);
|
||||
|
||||
// Update RTCRtpParameters
|
||||
// TODO: Both ways for things like ssrc, codecs, header extensions, etc
|
||||
@ -455,22 +441,6 @@ void TransceiverImpl::SyncWithJS(dom::RTCRtpTransceiver& aJsTransceiver,
|
||||
}
|
||||
}
|
||||
|
||||
// Update webrtc track id in JS; the ids in SDP are not surfaced to content,
|
||||
// because they don't follow the rules that track/stream ids must. Our JS
|
||||
// code must be able to map the SDP ids to the actual tracks/streams, and
|
||||
// this is how the mapping for track ids is updated.
|
||||
nsString webrtcTrackId =
|
||||
NS_ConvertUTF8toUTF16(mJsepTransceiver->mRecvTrack.GetTrackId().c_str());
|
||||
MOZ_MTLOG(ML_DEBUG, mPCHandle
|
||||
<< "[" << mMid << "]: " << __FUNCTION__
|
||||
<< " Setting webrtc track id: "
|
||||
<< mJsepTransceiver->mRecvTrack.GetTrackId().c_str());
|
||||
aJsTransceiver.SetRemoteTrackId(webrtcTrackId, aRv);
|
||||
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mid from JSEP
|
||||
if (mJsepTransceiver->IsAssociated()) {
|
||||
aJsTransceiver.SetMid(
|
||||
|
Loading…
Reference in New Issue
Block a user