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

Unified Diff: webrtc/api/peerconnection.cc

Issue 1775033002: Changed defaults for CreateAnswer in non-constraint mode (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review comments, bug fix Created 4 years, 9 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 | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnection.cc
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index c2039aeea414321e612e461d635df72e486904a3..bd158519af3ec450de209c737f52c4286909896e 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -429,6 +429,7 @@ class RemoteMediaStreamFactory {
bool ExtractMediaSessionOptions(
const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
+ bool is_offer,
cricket::MediaSessionOptions* session_options) {
typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
if (!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_audio) ||
@@ -436,11 +437,20 @@ bool ExtractMediaSessionOptions(
return false;
}
+ // If constraints don't prevent us, we always accept video.
if (rtc_options.offer_to_receive_audio != RTCOfferAnswerOptions::kUndefined) {
session_options->recv_audio = (rtc_options.offer_to_receive_audio > 0);
+ } else {
+ session_options->recv_audio = true;
}
+ // For offers, we only offer video if we have it or it's forced by options.
+ // For answers, we will always accept video (if offered).
if (rtc_options.offer_to_receive_video != RTCOfferAnswerOptions::kUndefined) {
session_options->recv_video = (rtc_options.offer_to_receive_video > 0);
+ } else if (is_offer) {
+ session_options->recv_video = false;
+ } else {
+ session_options->recv_video = true;
}
session_options->vad_enabled = rtc_options.voice_activity_detection;
@@ -1508,7 +1518,7 @@ bool PeerConnection::GetOptionsForOffer(
cricket::TransportOptions();
}
}
- if (!ExtractMediaSessionOptions(rtc_options, session_options)) {
+ if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) {
return false;
}
@@ -1579,7 +1589,7 @@ bool PeerConnection::GetOptionsForAnswer(
cricket::MediaSessionOptions* session_options) {
session_options->recv_audio = false;
session_options->recv_video = false;
- if (!ExtractMediaSessionOptions(options, session_options)) {
+ if (!ExtractMediaSessionOptions(options, false, session_options)) {
return false;
}
FinishOptionsForAnswer(session_options);
« no previous file with comments | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698