mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
SIPCall - trigger a re-invite on media source change
Changing the media source of a media stream (video in particular) must trigger a reinvite. Since currently we do not support changing video properties (resolution in particular) in the same media session, any changes in the video properties must trigger a re-invite to restart the media locally and on the remote peer. Gitlab: #653 Change-Id: Ibd6192135d272908963cfbc585bec95c66881a28
This commit is contained in:

committed by
Adrien Béraud

parent
932bf8182e
commit
d2a833db9d
@ -2244,7 +2244,12 @@ SIPCall::isReinviteRequired(const std::vector<MediaAttribute>& mediaAttrList)
|
||||
auto streamIdx = findRtpStreamIndex(newAttr.label_);
|
||||
|
||||
if (streamIdx == rtpStreams_.size()) {
|
||||
// Always needs a reinvite when a new media is added.
|
||||
// Always needs a re-invite when a new media is added.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Changing the source needs a re-invite
|
||||
if (newAttr.sourceUri_ != rtpStreams_[streamIdx].mediaAttribute_->sourceUri_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -113,12 +113,14 @@ private:
|
||||
void audio_and_video_then_mute_video();
|
||||
void audio_only_then_add_video();
|
||||
void audio_and_video_then_mute_audio();
|
||||
void audio_and_video_then_change_video_source();
|
||||
void audio_only_then_add_video_but_peer_disabled_multistream();
|
||||
|
||||
CPPUNIT_TEST_SUITE(MediaNegotiationTest);
|
||||
CPPUNIT_TEST(audio_and_video_then_mute_video);
|
||||
CPPUNIT_TEST(audio_only_then_add_video);
|
||||
CPPUNIT_TEST(audio_and_video_then_mute_audio);
|
||||
CPPUNIT_TEST(audio_and_video_then_change_video_source);
|
||||
CPPUNIT_TEST(audio_only_then_add_video_but_peer_disabled_multistream);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@ -842,6 +844,53 @@ MediaNegotiationTest::audio_and_video_then_mute_audio()
|
||||
JAMI_INFO("=== End test %s ===", __FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
MediaNegotiationTest::audio_and_video_then_change_video_source()
|
||||
{
|
||||
JAMI_INFO("=== Begin test %s ===", __FUNCTION__);
|
||||
|
||||
configureScenario(aliceData_, bobData_);
|
||||
|
||||
MediaAttribute defaultAudio(MediaType::MEDIA_AUDIO);
|
||||
defaultAudio.label_ = "audio_0";
|
||||
defaultAudio.enabled_ = true;
|
||||
|
||||
MediaAttribute defaultVideo(MediaType::MEDIA_VIDEO);
|
||||
defaultVideo.label_ = "video_0";
|
||||
defaultVideo.enabled_ = true;
|
||||
|
||||
{
|
||||
MediaAttribute audio(defaultAudio);
|
||||
MediaAttribute video(defaultVideo);
|
||||
|
||||
TestScenario scenario;
|
||||
// First offer/answer
|
||||
scenario.offer_.emplace_back(audio);
|
||||
scenario.offer_.emplace_back(video);
|
||||
scenario.answer_.emplace_back(audio);
|
||||
scenario.answer_.emplace_back(video);
|
||||
|
||||
// Updated offer/answer
|
||||
scenario.offerUpdate_.emplace_back(audio);
|
||||
// Just change the media source to validate that a new
|
||||
// media negotiation (re-invite) will be triggered.
|
||||
video.sourceUri_ = "Fake source";
|
||||
scenario.offerUpdate_.emplace_back(video);
|
||||
|
||||
scenario.answerUpdate_.emplace_back(audio);
|
||||
scenario.answerUpdate_.emplace_back(video);
|
||||
|
||||
scenario.expectMediaRenegotiation_ = true;
|
||||
scenario.expectMediaChangeRequest_ = false;
|
||||
|
||||
testWithScenario(aliceData_, bobData_, scenario);
|
||||
}
|
||||
|
||||
DRing::unregisterSignalHandlers();
|
||||
|
||||
JAMI_INFO("=== End test %s ===", __FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
MediaNegotiationTest::audio_only_then_add_video_but_peer_disabled_multistream()
|
||||
{
|
||||
|
Reference in New Issue
Block a user