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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 2064593003: Support legacy offerToReceiveAudio/offerToReceiveVideo fields in RTCOfferAnswerOptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: haraken's comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "public/platform/WebRTCDataChannelInit.h" 84 #include "public/platform/WebRTCDataChannelInit.h"
85 #include "public/platform/WebRTCICECandidate.h" 85 #include "public/platform/WebRTCICECandidate.h"
86 #include "public/platform/WebRTCKeyParams.h" 86 #include "public/platform/WebRTCKeyParams.h"
87 #include "public/platform/WebRTCOfferOptions.h" 87 #include "public/platform/WebRTCOfferOptions.h"
88 #include "public/platform/WebRTCSessionDescription.h" 88 #include "public/platform/WebRTCSessionDescription.h"
89 #include "public/platform/WebRTCSessionDescriptionRequest.h" 89 #include "public/platform/WebRTCSessionDescriptionRequest.h"
90 #include "public/platform/WebRTCStatsRequest.h" 90 #include "public/platform/WebRTCStatsRequest.h"
91 #include "public/platform/WebRTCVoidRequest.h" 91 #include "public/platform/WebRTCVoidRequest.h"
92 #include "wtf/CurrentTime.h" 92 #include "wtf/CurrentTime.h"
93 93
94 #include <algorithm>
94 #include <memory> 95 #include <memory>
95 96
96 namespace blink { 97 namespace blink {
97 98
98 namespace { 99 namespace {
99 100
100 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt ate is 'closed'."; 101 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt ate is 'closed'.";
101 102
102 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat e, ExceptionState& exceptionState) 103 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat e, ExceptionState& exceptionState)
103 { 104 {
(...skipping 30 matching lines...) Expand all
134 return !iceCandidateInit.hasSdpMid() && !iceCandidateInit.hasSdpMLineInd ex(); 135 return !iceCandidateInit.hasSdpMid() && !iceCandidateInit.hasSdpMLineInd ex();
135 } 136 }
136 137
137 DCHECK(candidate.isRTCIceCandidate()); 138 DCHECK(candidate.isRTCIceCandidate());
138 return false; 139 return false;
139 } 140 }
140 141
141 WebRTCOfferOptions convertToWebRTCOfferOptions(const RTCOfferOptions& options) 142 WebRTCOfferOptions convertToWebRTCOfferOptions(const RTCOfferOptions& options)
142 { 143 {
143 return WebRTCOfferOptions(RTCOfferOptionsPlatform::create( 144 return WebRTCOfferOptions(RTCOfferOptionsPlatform::create(
144 -1, -1, 145 options.hasOfferToReceiveVideo() ? std::max(options.offerToReceiveVideo( ), 0) : -1,
146 options.hasOfferToReceiveAudio() ? std::max(options.offerToReceiveAudio( ), 0) : -1,
145 options.hasVoiceActivityDetection() ? options.voiceActivityDetection() : true, 147 options.hasVoiceActivityDetection() ? options.voiceActivityDetection() : true,
146 options.hasIceRestart() ? options.iceRestart() : false)); 148 options.hasIceRestart() ? options.iceRestart() : false));
147 } 149 }
148 150
149 WebRTCAnswerOptions convertToWebRTCAnswerOptions(const RTCAnswerOptions& options ) 151 WebRTCAnswerOptions convertToWebRTCAnswerOptions(const RTCAnswerOptions& options )
150 { 152 {
151 return WebRTCAnswerOptions(RTCAnswerOptionsPlatform::create( 153 return WebRTCAnswerOptions(RTCAnswerOptionsPlatform::create(
154 options.hasOfferToReceiveVideo() ? std::max(options.offerToReceiveVideo( ), 0) : -1,
155 options.hasOfferToReceiveAudio() ? std::max(options.offerToReceiveAudio( ), 0) : -1,
152 options.hasVoiceActivityDetection() ? options.voiceActivityDetection() : true)); 156 options.hasVoiceActivityDetection() ? options.voiceActivityDetection() : true));
153 } 157 }
154 158
155 WebRTCICECandidate convertToWebRTCIceCandidate(ExecutionContext* context, const RTCIceCandidateInitOrRTCIceCandidate& candidate) 159 WebRTCICECandidate convertToWebRTCIceCandidate(ExecutionContext* context, const RTCIceCandidateInitOrRTCIceCandidate& candidate)
156 { 160 {
157 DCHECK(!candidate.isNull()); 161 DCHECK(!candidate.isNull());
158 if (candidate.isRTCIceCandidateInit()) { 162 if (candidate.isRTCIceCandidateInit()) {
159 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit(); 163 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit();
160 // TODO(guidou): Change default value to -1. crbug.com/614958. 164 // TODO(guidou): Change default value to -1. crbug.com/614958.
161 unsigned short sdpMLineIndex = 0; 165 unsigned short sdpMLineIndex = 0;
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 { 1231 {
1228 visitor->trace(m_localStreams); 1232 visitor->trace(m_localStreams);
1229 visitor->trace(m_remoteStreams); 1233 visitor->trace(m_remoteStreams);
1230 visitor->trace(m_dispatchScheduledEventRunner); 1234 visitor->trace(m_dispatchScheduledEventRunner);
1231 visitor->trace(m_scheduledEvents); 1235 visitor->trace(m_scheduledEvents);
1232 EventTargetWithInlineData::trace(visitor); 1236 EventTargetWithInlineData::trace(visitor);
1233 ActiveDOMObject::trace(visitor); 1237 ActiveDOMObject::trace(visitor);
1234 } 1238 }
1235 1239
1236 } // namespace blink 1240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698