From 28b120018135438eaff8307f3cdef921a697d47a Mon Sep 17 00:00:00 2001 From: trav90 Date: Sun, 4 Mar 2018 15:34:58 -0600 Subject: Fix some WebRTC tests to build with GCC 7.0. --- media/webrtc/signaling/test/mediaconduit_unittests.cpp | 18 ++++++++++++------ media/webrtc/signaling/test/signaling_unittests.cpp | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'media/webrtc') diff --git a/media/webrtc/signaling/test/mediaconduit_unittests.cpp b/media/webrtc/signaling/test/mediaconduit_unittests.cpp index f0cf95a47..adcc838bf 100644 --- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp +++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp @@ -550,14 +550,16 @@ class TransportConduitTest : public ::testing::Test mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&mAudioSession, &mozilla::AudioSessionConduit::Create)); - if( !mAudioSession ) + if( !mAudioSession ) { ASSERT_NE(mAudioSession, (void*)nullptr); + } mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&mAudioSession2, &mozilla::AudioSessionConduit::Create)); - if( !mAudioSession2 ) + if( !mAudioSession2 ) { ASSERT_NE(mAudioSession2, (void*)nullptr); + } WebrtcMediaTransport* xport = new WebrtcMediaTransport(); ASSERT_NE(xport, (void*)nullptr); @@ -615,15 +617,17 @@ class TransportConduitTest : public ::testing::Test mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&mVideoSession, &mozilla::VideoSessionConduit::Create)); - if( !mVideoSession ) + if( !mVideoSession ) { ASSERT_NE(mVideoSession, (void*)nullptr); + } // This session is for other one mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&mVideoSession2, &mozilla::VideoSessionConduit::Create)); - if( !mVideoSession2 ) + if( !mVideoSession2 ) { ASSERT_NE(mVideoSession2,(void*)nullptr); + } if (!send_vp8) { SetGmpCodecs(); @@ -716,8 +720,9 @@ class TransportConduitTest : public ::testing::Test mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&videoSession, &mozilla::VideoSessionConduit::Create)); - if( !videoSession ) + if( !videoSession ) { ASSERT_NE(videoSession, (void*)nullptr); + } //Test Configure Recv Codec APIS cerr << " *************************************************" << endl; @@ -831,8 +836,9 @@ class TransportConduitTest : public ::testing::Test mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&mVideoSession, &mozilla::VideoSessionConduit::Create)); - if( !mVideoSession ) + if( !mVideoSession ) { ASSERT_NE(mVideoSession, (void*)nullptr); + } mozilla::EncodingConstraints constraints; constraints.maxFs = max_fs; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 27d4750c7..1b393a9f0 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -1475,8 +1475,8 @@ class SignalingAgent { pObserver->addIceCandidateState = TestObserver::stateNoResponse; pc->AddIceCandidate(candidate.c_str(), mid.c_str(), level); ASSERT_TRUE(pObserver->addIceCandidateState == - expectSuccess ? TestObserver::stateSuccess : - TestObserver::stateError + (expectSuccess ? TestObserver::stateSuccess : + TestObserver::stateError) ); // Verify that adding ICE candidates does not change the signaling state -- cgit v1.2.3 From abf6ecee9f61e079ca93f2cb4bbdbed65688f048 Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Fri, 26 Jan 2018 11:46:51 -0500 Subject: Bug 1433005 - Simplify codec pruning in NegotiateCodecs. r=bwc, a=lizzard --HG-- extra : source : 90ae99509f1e9cb5bdf19350a5fbb1a02d34ff0a --- media/webrtc/signaling/src/jsep/JsepTrack.cpp | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'media/webrtc') diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signaling/src/jsep/JsepTrack.cpp index 1b045d8ec..cf5df96bf 100644 --- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp +++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp @@ -410,21 +410,26 @@ JsepTrack::NegotiateCodecs( // TODO(bug 814227): Remove this once we're ready to put multiple codecs in an // answer. For now, remove all but the first codec unless the red codec - // exists, and then we include the others per RFC 5109, section 14.2. - // Note: now allows keeping the telephone-event codec, if it appears, as the - // last codec in the list. + // exists, in which case we include the others per RFC 5109, section 14.2. if (!codecs->empty() && !red) { - int newSize = dtmf ? 2 : 1; - for (size_t i = 1; i < codecs->size(); ++i) { - if (!dtmf || dtmf != (*codecs)[i]) { - delete (*codecs)[i]; - (*codecs)[i] = nullptr; + std::vector codecsToKeep; + + bool foundPreferredCodec = false; + for (auto codec: *codecs) { + if (codec == dtmf) { + codecsToKeep.push_back(codec); + // TODO: keep ulpfec when we enable it in Bug 875922 + // } else if (codec == ulpfec) { + // codecsToKeep.push_back(codec); + } else if (!foundPreferredCodec) { + codecsToKeep.insert(codecsToKeep.begin(), codec); + foundPreferredCodec = true; + } else { + delete codec; } } - if (dtmf) { - (*codecs)[newSize-1] = dtmf; - } - codecs->resize(newSize); + + *codecs = codecsToKeep; } } -- cgit v1.2.3