| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 cached_volume_ = volume; | 59 cached_volume_ = volume; |
| 60 if (!channel_) { | 60 if (!channel_) { |
| 61 LOG(LS_ERROR) << "AudioRtpReceiver::OnSetVolume: No audio channel exists."; | 61 LOG(LS_ERROR) << "AudioRtpReceiver::OnSetVolume: No audio channel exists."; |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 // When the track is disabled, the volume of the source, which is the | 64 // When the track is disabled, the volume of the source, which is the |
| 65 // corresponding WebRtc Voice Engine channel will be 0. So we do not allow | 65 // corresponding WebRtc Voice Engine channel will be 0. So we do not allow |
| 66 // setting the volume to the source when the track is disabled. | 66 // setting the volume to the source when the track is disabled. |
| 67 if (!stopped_ && track_->enabled()) { | 67 if (!stopped_ && track_->enabled()) { |
| 68 if (!channel_->SetOutputVolume(ssrc_, cached_volume_)) { | 68 if (!channel_->SetOutputVolume(ssrc_, cached_volume_)) { |
| 69 RTC_DCHECK(false); | 69 RTC_NOTREACHED(); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 RtpParameters AudioRtpReceiver::GetParameters() const { | 74 RtpParameters AudioRtpReceiver::GetParameters() const { |
| 75 if (!channel_ || stopped_) { | 75 if (!channel_ || stopped_) { |
| 76 return RtpParameters(); | 76 return RtpParameters(); |
| 77 } | 77 } |
| 78 return channel_->GetRtpReceiveParameters(ssrc_); | 78 return channel_->GetRtpReceiveParameters(ssrc_); |
| 79 } | 79 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 void AudioRtpReceiver::Reconfigure() { | 102 void AudioRtpReceiver::Reconfigure() { |
| 103 RTC_DCHECK(!stopped_); | 103 RTC_DCHECK(!stopped_); |
| 104 if (!channel_) { | 104 if (!channel_) { |
| 105 LOG(LS_ERROR) << "AudioRtpReceiver::Reconfigure: No audio channel exists."; | 105 LOG(LS_ERROR) << "AudioRtpReceiver::Reconfigure: No audio channel exists."; |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 if (!channel_->SetOutputVolume(ssrc_, | 108 if (!channel_->SetOutputVolume(ssrc_, |
| 109 track_->enabled() ? cached_volume_ : 0)) { | 109 track_->enabled() ? cached_volume_ : 0)) { |
| 110 RTC_DCHECK(false); | 110 RTC_NOTREACHED(); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void AudioRtpReceiver::SetObserver(RtpReceiverObserverInterface* observer) { | 114 void AudioRtpReceiver::SetObserver(RtpReceiverObserverInterface* observer) { |
| 115 observer_ = observer; | 115 observer_ = observer; |
| 116 // Deliver any notifications the observer may have missed by being set late. | 116 // Deliver any notifications the observer may have missed by being set late. |
| 117 if (received_first_packet_ && observer_) { | 117 if (received_first_packet_ && observer_) { |
| 118 observer_->OnFirstPacketReceived(media_type()); | 118 observer_->OnFirstPacketReceived(media_type()); |
| 119 } | 119 } |
| 120 } | 120 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 track_id, | 154 track_id, |
| 155 VideoTrackSourceProxy::Create(rtc::Thread::Current(), | 155 VideoTrackSourceProxy::Create(rtc::Thread::Current(), |
| 156 worker_thread, | 156 worker_thread, |
| 157 source_)))) { | 157 source_)))) { |
| 158 source_->SetState(MediaSourceInterface::kLive); | 158 source_->SetState(MediaSourceInterface::kLive); |
| 159 if (!channel_) { | 159 if (!channel_) { |
| 160 LOG(LS_ERROR) | 160 LOG(LS_ERROR) |
| 161 << "VideoRtpReceiver::VideoRtpReceiver: No video channel exists."; | 161 << "VideoRtpReceiver::VideoRtpReceiver: No video channel exists."; |
| 162 } else { | 162 } else { |
| 163 if (!channel_->SetSink(ssrc_, &broadcaster_)) { | 163 if (!channel_->SetSink(ssrc_, &broadcaster_)) { |
| 164 RTC_DCHECK(false); | 164 RTC_NOTREACHED(); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 stream->AddTrack(track_); | 167 stream->AddTrack(track_); |
| 168 if (channel_) { | 168 if (channel_) { |
| 169 channel_->SignalFirstPacketReceived.connect( | 169 channel_->SignalFirstPacketReceived.connect( |
| 170 this, &VideoRtpReceiver::OnFirstPacketReceived); | 170 this, &VideoRtpReceiver::OnFirstPacketReceived); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 VideoRtpReceiver::~VideoRtpReceiver() { | 174 VideoRtpReceiver::~VideoRtpReceiver() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 void VideoRtpReceiver::SetChannel(cricket::VideoChannel* channel) { | 220 void VideoRtpReceiver::SetChannel(cricket::VideoChannel* channel) { |
| 221 if (channel_) { | 221 if (channel_) { |
| 222 channel_->SignalFirstPacketReceived.disconnect(this); | 222 channel_->SignalFirstPacketReceived.disconnect(this); |
| 223 channel_->SetSink(ssrc_, nullptr); | 223 channel_->SetSink(ssrc_, nullptr); |
| 224 } | 224 } |
| 225 channel_ = channel; | 225 channel_ = channel; |
| 226 if (channel_) { | 226 if (channel_) { |
| 227 if (!channel_->SetSink(ssrc_, &broadcaster_)) { | 227 if (!channel_->SetSink(ssrc_, &broadcaster_)) { |
| 228 RTC_DCHECK(false); | 228 RTC_NOTREACHED(); |
| 229 } | 229 } |
| 230 channel_->SignalFirstPacketReceived.connect( | 230 channel_->SignalFirstPacketReceived.connect( |
| 231 this, &VideoRtpReceiver::OnFirstPacketReceived); | 231 this, &VideoRtpReceiver::OnFirstPacketReceived); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 void VideoRtpReceiver::OnFirstPacketReceived(cricket::BaseChannel* channel) { | 235 void VideoRtpReceiver::OnFirstPacketReceived(cricket::BaseChannel* channel) { |
| 236 if (observer_) { | 236 if (observer_) { |
| 237 observer_->OnFirstPacketReceived(media_type()); | 237 observer_->OnFirstPacketReceived(media_type()); |
| 238 } | 238 } |
| 239 received_first_packet_ = true; | 239 received_first_packet_ = true; |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace webrtc | 242 } // namespace webrtc |
| OLD | NEW |