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

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

Issue 1741933002: Prevent a voice channel from sending data before a renderer is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Modifying copyright header to satisfy presubmit bot. 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/rtpsender.h ('k') | webrtc/api/rtpsenderreceiver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 int sample_rate, 29 int sample_rate,
30 size_t number_of_channels, 30 size_t number_of_channels,
31 size_t number_of_frames) { 31 size_t number_of_frames) {
32 rtc::CritScope lock(&lock_); 32 rtc::CritScope lock(&lock_);
33 if (sink_) { 33 if (sink_) {
34 sink_->OnData(audio_data, bits_per_sample, sample_rate, number_of_channels, 34 sink_->OnData(audio_data, bits_per_sample, sample_rate, number_of_channels,
35 number_of_frames); 35 number_of_frames);
36 } 36 }
37 } 37 }
38 38
39 void LocalAudioSinkAdapter::SetSink(cricket::AudioRenderer::Sink* sink) { 39 void LocalAudioSinkAdapter::SetSink(cricket::AudioSource::Sink* sink) {
40 rtc::CritScope lock(&lock_); 40 rtc::CritScope lock(&lock_);
41 ASSERT(!sink || !sink_); 41 ASSERT(!sink || !sink_);
42 sink_ = sink; 42 sink_ = sink;
43 } 43 }
44 44
45 AudioRtpSender::AudioRtpSender(AudioTrackInterface* track, 45 AudioRtpSender::AudioRtpSender(AudioTrackInterface* track,
46 const std::string& stream_id, 46 const std::string& stream_id,
47 AudioProviderInterface* provider, 47 AudioProviderInterface* provider,
48 StatsCollector* stats) 48 StatsCollector* stats)
49 : id_(track->id()), 49 : id_(track->id()),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // PeerConnection. This is a bit of a strange way to apply local audio 187 // PeerConnection. This is a bit of a strange way to apply local audio
188 // options since it is also applied to all streams/channels, local or remote. 188 // options since it is also applied to all streams/channels, local or remote.
189 if (track_->enabled() && track_->GetSource() && 189 if (track_->enabled() && track_->GetSource() &&
190 !track_->GetSource()->remote()) { 190 !track_->GetSource()->remote()) {
191 // TODO(xians): Remove this static_cast since we should be able to connect 191 // TODO(xians): Remove this static_cast since we should be able to connect
192 // a remote audio track to a peer connection. 192 // a remote audio track to a peer connection.
193 options = static_cast<LocalAudioSource*>(track_->GetSource())->options(); 193 options = static_cast<LocalAudioSource*>(track_->GetSource())->options();
194 } 194 }
195 #endif 195 #endif
196 196
197 cricket::AudioRenderer* renderer = sink_adapter_.get(); 197 cricket::AudioSource* source = sink_adapter_.get();
198 ASSERT(renderer != nullptr); 198 ASSERT(source != nullptr);
199 provider_->SetAudioSend(ssrc_, track_->enabled(), options, renderer); 199 provider_->SetAudioSend(ssrc_, track_->enabled(), options, source);
200 } 200 }
201 201
202 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track, 202 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track,
203 const std::string& stream_id, 203 const std::string& stream_id,
204 VideoProviderInterface* provider) 204 VideoProviderInterface* provider)
205 : id_(track->id()), 205 : id_(track->id()),
206 stream_id_(stream_id), 206 stream_id_(stream_id),
207 provider_(provider), 207 provider_(provider),
208 track_(track), 208 track_(track),
209 cached_track_enabled_(track->enabled()) { 209 cached_track_enabled_(track->enabled()) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 RTC_DCHECK(!stopped_ && can_send_track()); 322 RTC_DCHECK(!stopped_ && can_send_track());
323 const cricket::VideoOptions* options = nullptr; 323 const cricket::VideoOptions* options = nullptr;
324 VideoTrackSourceInterface* source = track_->GetSource(); 324 VideoTrackSourceInterface* source = track_->GetSource();
325 if (track_->enabled() && source) { 325 if (track_->enabled() && source) {
326 options = source->options(); 326 options = source->options();
327 } 327 }
328 provider_->SetVideoSend(ssrc_, track_->enabled(), options); 328 provider_->SetVideoSend(ssrc_, track_->enabled(), options);
329 } 329 }
330 330
331 } // namespace webrtc 331 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/rtpsender.h ('k') | webrtc/api/rtpsenderreceiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698