| Index: talk/session/media/mediasession.cc
|
| diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc
|
| index 7413026092f1d6f8c8742e407d48376ac5a5ea01..89214b07a0b4897fa13a32dcdfb852a371c2ab8a 100644
|
| --- a/talk/session/media/mediasession.cc
|
| +++ b/talk/session/media/mediasession.cc
|
| @@ -516,42 +516,6 @@ static bool AddStreamParams(
|
| return true;
|
| }
|
|
|
| -// Updates the transport infos of the |sdesc| according to the given
|
| -// |bundle_group|. The transport infos of the content names within the
|
| -// |bundle_group| should be updated to use the ufrag and pwd of the first
|
| -// content within the |bundle_group|.
|
| -static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group,
|
| - SessionDescription* sdesc) {
|
| - // The bundle should not be empty.
|
| - if (!sdesc || !bundle_group.FirstContentName()) {
|
| - return false;
|
| - }
|
| -
|
| - // We should definitely have a transport for the first content.
|
| - const std::string& selected_content_name = *bundle_group.FirstContentName();
|
| - const TransportInfo* selected_transport_info =
|
| - sdesc->GetTransportInfoByName(selected_content_name);
|
| - if (!selected_transport_info) {
|
| - return false;
|
| - }
|
| -
|
| - // Set the other contents to use the same ICE credentials.
|
| - const std::string& selected_ufrag =
|
| - selected_transport_info->description.ice_ufrag;
|
| - const std::string& selected_pwd =
|
| - selected_transport_info->description.ice_pwd;
|
| - for (TransportInfos::iterator it =
|
| - sdesc->transport_infos().begin();
|
| - it != sdesc->transport_infos().end(); ++it) {
|
| - if (bundle_group.HasContentName(it->content_name) &&
|
| - it->content_name != selected_content_name) {
|
| - it->description.ice_ufrag = selected_ufrag;
|
| - it->description.ice_pwd = selected_pwd;
|
| - }
|
| - }
|
| - return true;
|
| -}
|
| -
|
| // Gets the CryptoParamsVec of the given |content_name| from |sdesc|, and
|
| // sets it to |cryptos|.
|
| static bool GetCryptosByName(const SessionDescription* sdesc,
|
| @@ -1294,10 +1258,6 @@ SessionDescription* MediaSessionDescriptionFactory::CreateOffer(
|
| offer_bundle.AddContentName(content->name);
|
| }
|
| offer->AddGroup(offer_bundle);
|
| - if (!UpdateTransportInfoForBundle(offer_bundle, offer.get())) {
|
| - LOG(LS_ERROR) << "CreateOffer failed to UpdateTransportInfoForBundle.";
|
| - return NULL;
|
| - }
|
| if (!UpdateCryptoParamsForBundle(offer_bundle, offer.get())) {
|
| LOG(LS_ERROR) << "CreateOffer failed to UpdateCryptoParamsForBundle.";
|
| return NULL;
|
| @@ -1354,14 +1314,6 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer(
|
| }
|
| if (answer_bundle.FirstContentName()) {
|
| answer->AddGroup(answer_bundle);
|
| -
|
| - // Share the same ICE credentials and crypto params across all contents,
|
| - // as BUNDLE requires.
|
| - if (!UpdateTransportInfoForBundle(answer_bundle, answer.get())) {
|
| - LOG(LS_ERROR) << "CreateAnswer failed to UpdateTransportInfoForBundle.";
|
| - return NULL;
|
| - }
|
| -
|
| if (!UpdateCryptoParamsForBundle(answer_bundle, answer.get())) {
|
| LOG(LS_ERROR) << "CreateAnswer failed to UpdateCryptoParamsForBundle.";
|
| return NULL;
|
| @@ -1453,16 +1405,18 @@ void MediaSessionDescriptionFactory::GetRtpHdrExtsToOffer(
|
| }
|
|
|
| bool MediaSessionDescriptionFactory::AddTransportOffer(
|
| - const std::string& content_name,
|
| - const TransportOptions& transport_options,
|
| - const SessionDescription* current_desc,
|
| - SessionDescription* offer_desc) const {
|
| + const std::string& content_name,
|
| + const TransportOptions& transport_options,
|
| + bool ice_restart,
|
| + const SessionDescription* current_desc,
|
| + SessionDescription* offer_desc) const {
|
| if (!transport_desc_factory_)
|
| return false;
|
| const TransportDescription* current_tdesc =
|
| GetTransportDescription(content_name, current_desc);
|
| rtc::scoped_ptr<TransportDescription> new_tdesc(
|
| - transport_desc_factory_->CreateOffer(transport_options, current_tdesc));
|
| + transport_desc_factory_->CreateOffer(transport_options, ice_restart,
|
| + current_tdesc));
|
| bool ret = (new_tdesc.get() != NULL &&
|
| offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc)));
|
| if (!ret) {
|
| @@ -1476,6 +1430,7 @@ TransportDescription* MediaSessionDescriptionFactory::CreateTransportAnswer(
|
| const std::string& content_name,
|
| const SessionDescription* offer_desc,
|
| const TransportOptions& transport_options,
|
| + bool ice_restart,
|
| const SessionDescription* current_desc) const {
|
| if (!transport_desc_factory_)
|
| return NULL;
|
| @@ -1483,9 +1438,8 @@ TransportDescription* MediaSessionDescriptionFactory::CreateTransportAnswer(
|
| GetTransportDescription(content_name, offer_desc);
|
| const TransportDescription* current_tdesc =
|
| GetTransportDescription(content_name, current_desc);
|
| - return
|
| - transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options,
|
| - current_tdesc);
|
| + return transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options,
|
| + ice_restart, current_tdesc);
|
| }
|
|
|
| bool MediaSessionDescriptionFactory::AddTransportAnswer(
|
| @@ -1548,7 +1502,8 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer(
|
|
|
| desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release());
|
| if (!AddTransportOffer(CN_AUDIO, options.transport_options,
|
| - current_description, desc)) {
|
| + options.audio_ice_restart, current_description,
|
| + desc)) {
|
| return false;
|
| }
|
|
|
| @@ -1603,7 +1558,8 @@ bool MediaSessionDescriptionFactory::AddVideoContentForOffer(
|
|
|
| desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release());
|
| if (!AddTransportOffer(CN_VIDEO, options.transport_options,
|
| - current_description, desc)) {
|
| + options.video_ice_restart, current_description,
|
| + desc)) {
|
| return false;
|
| }
|
|
|
| @@ -1662,7 +1618,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForOffer(
|
| desc->AddContent(CN_DATA, NS_JINGLE_RTP, data.release());
|
| }
|
| if (!AddTransportOffer(CN_DATA, options.transport_options,
|
| - current_description, desc)) {
|
| + options.data_ice_restart, current_description, desc)) {
|
| return false;
|
| }
|
| return true;
|
| @@ -1676,10 +1632,9 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
|
| SessionDescription* answer) const {
|
| const ContentInfo* audio_content = GetFirstAudioContent(offer);
|
|
|
| - scoped_ptr<TransportDescription> audio_transport(
|
| - CreateTransportAnswer(audio_content->name, offer,
|
| - options.transport_options,
|
| - current_description));
|
| + scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer(
|
| + audio_content->name, offer, options.transport_options,
|
| + options.audio_ice_restart, current_description));
|
| if (!audio_transport) {
|
| return false;
|
| }
|
| @@ -1735,10 +1690,9 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
|
| StreamParamsVec* current_streams,
|
| SessionDescription* answer) const {
|
| const ContentInfo* video_content = GetFirstVideoContent(offer);
|
| - scoped_ptr<TransportDescription> video_transport(
|
| - CreateTransportAnswer(video_content->name, offer,
|
| - options.transport_options,
|
| - current_description));
|
| + scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer(
|
| + video_content->name, offer, options.transport_options,
|
| + options.video_ice_restart, current_description));
|
| if (!video_transport) {
|
| return false;
|
| }
|
| @@ -1791,10 +1745,9 @@ bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
|
| StreamParamsVec* current_streams,
|
| SessionDescription* answer) const {
|
| const ContentInfo* data_content = GetFirstDataContent(offer);
|
| - scoped_ptr<TransportDescription> data_transport(
|
| - CreateTransportAnswer(data_content->name, offer,
|
| - options.transport_options,
|
| - current_description));
|
| + scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer(
|
| + data_content->name, offer, options.transport_options,
|
| + options.data_ice_restart, current_description));
|
| if (!data_transport) {
|
| return false;
|
| }
|
| @@ -1862,8 +1815,8 @@ bool IsDataContent(const ContentInfo* content) {
|
| return IsMediaContentOfType(content, MEDIA_TYPE_DATA);
|
| }
|
|
|
| -static const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
|
| - MediaType media_type) {
|
| +const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
|
| + MediaType media_type) {
|
| for (ContentInfos::const_iterator content = contents.begin();
|
| content != contents.end(); content++) {
|
| if (IsMediaContentOfType(&*content, media_type)) {
|
|
|