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

Side by Side Diff: webrtc/api/rtpsender.cc

Issue 2023373002: Separating internal and external methods of RtpSender/RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (stats_) { 138 if (stats_) {
139 stats_->AddLocalAudioTrack(track_.get(), ssrc_); 139 stats_->AddLocalAudioTrack(track_.get(), ssrc_);
140 } 140 }
141 } else if (prev_can_send_track) { 141 } else if (prev_can_send_track) {
142 cricket::AudioOptions options; 142 cricket::AudioOptions options;
143 provider_->SetAudioSend(ssrc_, false, options, nullptr); 143 provider_->SetAudioSend(ssrc_, false, options, nullptr);
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 RtpParameters AudioRtpSender::GetParameters() const {
149 return provider_->GetAudioRtpParameters(ssrc_);
150 }
151
152 bool AudioRtpSender::SetParameters(const RtpParameters& parameters) {
153 TRACE_EVENT0("webrtc", "AudioRtpSender::SetParameters");
154 return provider_->SetAudioRtpParameters(ssrc_, parameters);
155 }
156
148 void AudioRtpSender::SetSsrc(uint32_t ssrc) { 157 void AudioRtpSender::SetSsrc(uint32_t ssrc) {
149 TRACE_EVENT0("webrtc", "AudioRtpSender::SetSsrc"); 158 TRACE_EVENT0("webrtc", "AudioRtpSender::SetSsrc");
150 if (stopped_ || ssrc == ssrc_) { 159 if (stopped_ || ssrc == ssrc_) {
151 return; 160 return;
152 } 161 }
153 // If we are already sending with a particular SSRC, stop sending. 162 // If we are already sending with a particular SSRC, stop sending.
154 if (can_send_track()) { 163 if (can_send_track()) {
155 cricket::AudioOptions options; 164 cricket::AudioOptions options;
156 provider_->SetAudioSend(ssrc_, false, options, nullptr); 165 provider_->SetAudioSend(ssrc_, false, options, nullptr);
157 if (stats_) { 166 if (stats_) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // a remote audio track to a peer connection. 209 // a remote audio track to a peer connection.
201 options = static_cast<LocalAudioSource*>(track_->GetSource())->options(); 210 options = static_cast<LocalAudioSource*>(track_->GetSource())->options();
202 } 211 }
203 #endif 212 #endif
204 213
205 cricket::AudioSource* source = sink_adapter_.get(); 214 cricket::AudioSource* source = sink_adapter_.get();
206 ASSERT(source != nullptr); 215 ASSERT(source != nullptr);
207 provider_->SetAudioSend(ssrc_, track_->enabled(), options, source); 216 provider_->SetAudioSend(ssrc_, track_->enabled(), options, source);
208 } 217 }
209 218
210 RtpParameters AudioRtpSender::GetParameters() const {
211 return provider_->GetAudioRtpParameters(ssrc_);
212 }
213
214 bool AudioRtpSender::SetParameters(const RtpParameters& parameters) {
215 TRACE_EVENT0("webrtc", "AudioRtpSender::SetParameters");
216 return provider_->SetAudioRtpParameters(ssrc_, parameters);
217 }
218
219 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track, 219 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track,
220 const std::string& stream_id, 220 const std::string& stream_id,
221 VideoProviderInterface* provider) 221 VideoProviderInterface* provider)
222 : id_(track->id()), 222 : id_(track->id()),
223 stream_id_(stream_id), 223 stream_id_(stream_id),
224 provider_(provider), 224 provider_(provider),
225 track_(track), 225 track_(track),
226 cached_track_enabled_(track->enabled()) { 226 cached_track_enabled_(track->enabled()) {
227 RTC_DCHECK(provider != nullptr); 227 RTC_DCHECK(provider != nullptr);
228 track_->RegisterObserver(this); 228 track_->RegisterObserver(this);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 provider_->SetSource(ssrc_, track_); 299 provider_->SetSource(ssrc_, track_);
300 SetVideoSend(); 300 SetVideoSend();
301 } else if (prev_can_send_track) { 301 } else if (prev_can_send_track) {
302 provider_->SetSource(ssrc_, nullptr); 302 provider_->SetSource(ssrc_, nullptr);
303 provider_->SetVideoSend(ssrc_, false, nullptr); 303 provider_->SetVideoSend(ssrc_, false, nullptr);
304 } 304 }
305 return true; 305 return true;
306 } 306 }
307 307
308 RtpParameters VideoRtpSender::GetParameters() const {
309 return provider_->GetVideoRtpParameters(ssrc_);
310 }
311
312 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) {
313 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters");
314 return provider_->SetVideoRtpParameters(ssrc_, parameters);
315 }
316
308 void VideoRtpSender::SetSsrc(uint32_t ssrc) { 317 void VideoRtpSender::SetSsrc(uint32_t ssrc) {
309 TRACE_EVENT0("webrtc", "VideoRtpSender::SetSsrc"); 318 TRACE_EVENT0("webrtc", "VideoRtpSender::SetSsrc");
310 if (stopped_ || ssrc == ssrc_) { 319 if (stopped_ || ssrc == ssrc_) {
311 return; 320 return;
312 } 321 }
313 // If we are already sending with a particular SSRC, stop sending. 322 // If we are already sending with a particular SSRC, stop sending.
314 if (can_send_track()) { 323 if (can_send_track()) {
315 provider_->SetSource(ssrc_, nullptr); 324 provider_->SetSource(ssrc_, nullptr);
316 provider_->SetVideoSend(ssrc_, false, nullptr); 325 provider_->SetVideoSend(ssrc_, false, nullptr);
317 } 326 }
(...skipping 24 matching lines...) Expand all
342 RTC_DCHECK(!stopped_ && can_send_track()); 351 RTC_DCHECK(!stopped_ && can_send_track());
343 cricket::VideoOptions options; 352 cricket::VideoOptions options;
344 VideoTrackSourceInterface* source = track_->GetSource(); 353 VideoTrackSourceInterface* source = track_->GetSource();
345 if (source) { 354 if (source) {
346 options.is_screencast = rtc::Optional<bool>(source->is_screencast()); 355 options.is_screencast = rtc::Optional<bool>(source->is_screencast());
347 options.video_noise_reduction = source->needs_denoising(); 356 options.video_noise_reduction = source->needs_denoising();
348 } 357 }
349 provider_->SetVideoSend(ssrc_, track_->enabled(), &options); 358 provider_->SetVideoSend(ssrc_, track_->enabled(), &options);
350 } 359 }
351 360
352 RtpParameters VideoRtpSender::GetParameters() const {
353 return provider_->GetVideoRtpParameters(ssrc_);
354 }
355
356 bool VideoRtpSender::SetParameters(const RtpParameters& parameters) {
357 TRACE_EVENT0("webrtc", "VideoRtpSender::SetParameters");
358 return provider_->SetVideoRtpParameters(ssrc_, parameters);
359 }
360
361 } // namespace webrtc 361 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698