| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AudioRtpReceiver::OnSetVolume(double volume) { | 53 void AudioRtpReceiver::OnSetVolume(double volume) { |
| 54 // When the track is disabled, the volume of the source, which is the | 54 // When the track is disabled, the volume of the source, which is the |
| 55 // corresponding WebRtc Voice Engine channel will be 0. So we do not allow | 55 // corresponding WebRtc Voice Engine channel will be 0. So we do not allow |
| 56 // setting the volume to the source when the track is disabled. | 56 // setting the volume to the source when the track is disabled. |
| 57 if (provider_ && track_->enabled()) | 57 if (provider_ && track_->enabled()) |
| 58 provider_->SetAudioPlayoutVolume(ssrc_, volume); | 58 provider_->SetAudioPlayoutVolume(ssrc_, volume); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AudioRtpReceiver::Stop() { | |
| 62 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | |
| 63 if (!provider_) { | |
| 64 return; | |
| 65 } | |
| 66 provider_->SetAudioPlayout(ssrc_, false); | |
| 67 provider_ = nullptr; | |
| 68 } | |
| 69 | |
| 70 RtpParameters AudioRtpReceiver::GetParameters() const { | 61 RtpParameters AudioRtpReceiver::GetParameters() const { |
| 71 return provider_->GetAudioRtpReceiveParameters(ssrc_); | 62 return provider_->GetAudioRtpReceiveParameters(ssrc_); |
| 72 } | 63 } |
| 73 | 64 |
| 74 bool AudioRtpReceiver::SetParameters(const RtpParameters& parameters) { | 65 bool AudioRtpReceiver::SetParameters(const RtpParameters& parameters) { |
| 75 TRACE_EVENT0("webrtc", "AudioRtpReceiver::SetParameters"); | 66 TRACE_EVENT0("webrtc", "AudioRtpReceiver::SetParameters"); |
| 76 return provider_->SetAudioRtpReceiveParameters(ssrc_, parameters); | 67 return provider_->SetAudioRtpReceiveParameters(ssrc_, parameters); |
| 77 } | 68 } |
| 78 | 69 |
| 70 void AudioRtpReceiver::Stop() { |
| 71 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
| 72 if (!provider_) { |
| 73 return; |
| 74 } |
| 75 provider_->SetAudioPlayout(ssrc_, false); |
| 76 provider_ = nullptr; |
| 77 } |
| 78 |
| 79 void AudioRtpReceiver::Reconfigure() { | 79 void AudioRtpReceiver::Reconfigure() { |
| 80 if (!provider_) { | 80 if (!provider_) { |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 provider_->SetAudioPlayout(ssrc_, track_->enabled()); | 83 provider_->SetAudioPlayout(ssrc_, track_->enabled()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream, | 86 VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream, |
| 87 const std::string& track_id, | 87 const std::string& track_id, |
| 88 rtc::Thread* worker_thread, | 88 rtc::Thread* worker_thread, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 105 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); | 105 provider_->SetVideoPlayout(ssrc_, true, &broadcaster_); |
| 106 stream->AddTrack(track_); | 106 stream->AddTrack(track_); |
| 107 } | 107 } |
| 108 | 108 |
| 109 VideoRtpReceiver::~VideoRtpReceiver() { | 109 VideoRtpReceiver::~VideoRtpReceiver() { |
| 110 // Since cricket::VideoRenderer is not reference counted, | 110 // Since cricket::VideoRenderer is not reference counted, |
| 111 // we need to remove it from the provider before we are deleted. | 111 // we need to remove it from the provider before we are deleted. |
| 112 Stop(); | 112 Stop(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 RtpParameters VideoRtpReceiver::GetParameters() const { |
| 116 return provider_->GetVideoRtpReceiveParameters(ssrc_); |
| 117 } |
| 118 |
| 119 bool VideoRtpReceiver::SetParameters(const RtpParameters& parameters) { |
| 120 TRACE_EVENT0("webrtc", "VideoRtpReceiver::SetParameters"); |
| 121 return provider_->SetVideoRtpReceiveParameters(ssrc_, parameters); |
| 122 } |
| 123 |
| 115 void VideoRtpReceiver::Stop() { | 124 void VideoRtpReceiver::Stop() { |
| 116 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 125 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
| 117 if (!provider_) { | 126 if (!provider_) { |
| 118 return; | 127 return; |
| 119 } | 128 } |
| 120 source_->SetState(MediaSourceInterface::kEnded); | 129 source_->SetState(MediaSourceInterface::kEnded); |
| 121 source_->OnSourceDestroyed(); | 130 source_->OnSourceDestroyed(); |
| 122 provider_->SetVideoPlayout(ssrc_, false, nullptr); | 131 provider_->SetVideoPlayout(ssrc_, false, nullptr); |
| 123 provider_ = nullptr; | 132 provider_ = nullptr; |
| 124 } | 133 } |
| 125 | 134 |
| 126 RtpParameters VideoRtpReceiver::GetParameters() const { | |
| 127 return provider_->GetVideoRtpReceiveParameters(ssrc_); | |
| 128 } | |
| 129 | |
| 130 bool VideoRtpReceiver::SetParameters(const RtpParameters& parameters) { | |
| 131 TRACE_EVENT0("webrtc", "VideoRtpReceiver::SetParameters"); | |
| 132 return provider_->SetVideoRtpReceiveParameters(ssrc_, parameters); | |
| 133 } | |
| 134 | |
| 135 } // namespace webrtc | 135 } // namespace webrtc |
| OLD | NEW |