OLD | NEW |
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 |
11 #include "webrtc/api/rtpsender.h" | 11 #include "webrtc/api/rtpsender.h" |
12 | 12 |
13 #include "webrtc/api/localaudiosource.h" | 13 #include "webrtc/api/localaudiosource.h" |
14 #include "webrtc/api/mediastreaminterface.h" | 14 #include "webrtc/api/mediastreaminterface.h" |
| 15 #include "webrtc/base/checks.h" |
15 #include "webrtc/base/helpers.h" | 16 #include "webrtc/base/helpers.h" |
16 #include "webrtc/base/trace_event.h" | 17 #include "webrtc/base/trace_event.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 LocalAudioSinkAdapter::LocalAudioSinkAdapter() : sink_(nullptr) {} | 21 LocalAudioSinkAdapter::LocalAudioSinkAdapter() : sink_(nullptr) {} |
21 | 22 |
22 LocalAudioSinkAdapter::~LocalAudioSinkAdapter() { | 23 LocalAudioSinkAdapter::~LocalAudioSinkAdapter() { |
23 rtc::CritScope lock(&lock_); | 24 rtc::CritScope lock(&lock_); |
24 if (sink_) | 25 if (sink_) |
25 sink_->OnClose(); | 26 sink_->OnClose(); |
26 } | 27 } |
27 | 28 |
28 void LocalAudioSinkAdapter::OnData(const void* audio_data, | 29 void LocalAudioSinkAdapter::OnData(const void* audio_data, |
29 int bits_per_sample, | 30 int bits_per_sample, |
30 int sample_rate, | 31 int sample_rate, |
31 size_t number_of_channels, | 32 size_t number_of_channels, |
32 size_t number_of_frames) { | 33 size_t number_of_frames) { |
33 rtc::CritScope lock(&lock_); | 34 rtc::CritScope lock(&lock_); |
34 if (sink_) { | 35 if (sink_) { |
35 sink_->OnData(audio_data, bits_per_sample, sample_rate, number_of_channels, | 36 sink_->OnData(audio_data, bits_per_sample, sample_rate, number_of_channels, |
36 number_of_frames); | 37 number_of_frames); |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
40 void LocalAudioSinkAdapter::SetSink(cricket::AudioSource::Sink* sink) { | 41 void LocalAudioSinkAdapter::SetSink(cricket::AudioSource::Sink* sink) { |
41 rtc::CritScope lock(&lock_); | 42 rtc::CritScope lock(&lock_); |
42 ASSERT(!sink || !sink_); | 43 RTC_DCHECK(!sink || !sink_); |
43 sink_ = sink; | 44 sink_ = sink; |
44 } | 45 } |
45 | 46 |
46 AudioRtpSender::AudioRtpSender(AudioTrackInterface* track, | 47 AudioRtpSender::AudioRtpSender(AudioTrackInterface* track, |
47 const std::string& stream_id, | 48 const std::string& stream_id, |
48 cricket::VoiceChannel* channel, | 49 cricket::VoiceChannel* channel, |
49 StatsCollector* stats) | 50 StatsCollector* stats) |
50 : id_(track->id()), | 51 : id_(track->id()), |
51 stream_id_(stream_id), | 52 stream_id_(stream_id), |
52 channel_(channel), | 53 channel_(channel), |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; | 400 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; |
400 return; | 401 return; |
401 } | 402 } |
402 // Allow SetVideoSend to fail since |enable| is false and |source| is null. | 403 // Allow SetVideoSend to fail since |enable| is false and |source| is null. |
403 // This the normal case when the underlying media channel has already been | 404 // This the normal case when the underlying media channel has already been |
404 // deleted. | 405 // deleted. |
405 channel_->SetVideoSend(ssrc_, false, nullptr, nullptr); | 406 channel_->SetVideoSend(ssrc_, false, nullptr, nullptr); |
406 } | 407 } |
407 | 408 |
408 } // namespace webrtc | 409 } // namespace webrtc |
OLD | NEW |