Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: talk/session/media/mediasession.cc

Issue 1406803004: Fixing some issues with the direction attribute of m-lines in offers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing a comment. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/sessiondescription.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/session/media/mediasession.cc
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc
index 2cd2d46d9ca5adbf28f61a83b7b501354a99be75..7413026092f1d6f8c8742e407d48376ac5a5ea01 100644
--- a/talk/session/media/mediasession.cc
+++ b/talk/session/media/mediasession.cc
@@ -1036,12 +1036,15 @@ static bool CreateMediaContentAnswer(
answer->set_direction(MD_RECVONLY);
break;
case MD_RECVONLY:
- answer->set_direction(MD_SENDONLY);
+ answer->set_direction(answer->streams().empty() ? MD_INACTIVE
+ : MD_SENDONLY);
break;
case MD_SENDRECV:
- answer->set_direction(MD_SENDRECV);
+ answer->set_direction(answer->streams().empty() ? MD_RECVONLY
+ : MD_SENDRECV);
pthatcher 2015/11/23 18:00:52 It looks like this breaks data channels. If we're
break;
default:
+ RTC_DCHECK(false && "MediaContentDescription has unexpected direction.");
break;
}
@@ -1529,8 +1532,18 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer(
bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
SetMediaProtocol(secure_transport, audio.get());
- if (!options.recv_audio) {
- audio->set_direction(MD_SENDONLY);
+ if (!audio->streams().empty()) {
+ if (options.recv_audio) {
+ audio->set_direction(MD_SENDRECV);
+ } else {
+ audio->set_direction(MD_SENDONLY);
+ }
+ } else {
+ if (options.recv_audio) {
+ audio->set_direction(MD_RECVONLY);
+ } else {
+ audio->set_direction(MD_INACTIVE);
+ }
}
desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release());
@@ -1574,8 +1587,18 @@ bool MediaSessionDescriptionFactory::AddVideoContentForOffer(
bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
SetMediaProtocol(secure_transport, video.get());
- if (!options.recv_video) {
- video->set_direction(MD_SENDONLY);
+ if (!video->streams().empty()) {
+ if (options.recv_video) {
+ video->set_direction(MD_SENDRECV);
+ } else {
+ video->set_direction(MD_SENDONLY);
+ }
+ } else {
+ if (options.recv_video) {
+ video->set_direction(MD_RECVONLY);
+ } else {
+ video->set_direction(MD_INACTIVE);
+ }
}
desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release());
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/sessiondescription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698