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/rtpreceiver.h" | 11 #include "webrtc/api/rtpreceiver.h" |
12 | 12 |
13 #include "webrtc/api/mediastreamtrackproxy.h" | 13 #include "webrtc/api/mediastreamtrackproxy.h" |
14 #include "webrtc/api/audiotrack.h" | 14 #include "webrtc/api/audiotrack.h" |
15 #include "webrtc/api/videosourceproxy.h" | 15 #include "webrtc/api/videosourceproxy.h" |
16 #include "webrtc/api/videotrack.h" | 16 #include "webrtc/api/videotrack.h" |
| 17 #include "webrtc/base/trace_event.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 AudioRtpReceiver::AudioRtpReceiver(MediaStreamInterface* stream, | 21 AudioRtpReceiver::AudioRtpReceiver(MediaStreamInterface* stream, |
21 const std::string& track_id, | 22 const std::string& track_id, |
22 uint32_t ssrc, | 23 uint32_t ssrc, |
23 AudioProviderInterface* provider) | 24 AudioProviderInterface* provider) |
24 : id_(track_id), | 25 : id_(track_id), |
25 ssrc_(ssrc), | 26 ssrc_(ssrc), |
26 provider_(provider), | 27 provider_(provider), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 60 |
60 void AudioRtpReceiver::Stop() { | 61 void AudioRtpReceiver::Stop() { |
61 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 62 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
62 if (!provider_) { | 63 if (!provider_) { |
63 return; | 64 return; |
64 } | 65 } |
65 provider_->SetAudioPlayout(ssrc_, false); | 66 provider_->SetAudioPlayout(ssrc_, false); |
66 provider_ = nullptr; | 67 provider_ = nullptr; |
67 } | 68 } |
68 | 69 |
| 70 RtpParameters AudioRtpReceiver::GetParameters() const { |
| 71 return provider_->GetAudioRtpReceiveParameters(ssrc_); |
| 72 } |
| 73 |
| 74 bool AudioRtpReceiver::SetParameters(const RtpParameters& parameters) { |
| 75 TRACE_EVENT0("webrtc", "AudioRtpReceiver::SetParameters"); |
| 76 return provider_->SetAudioRtpReceiveParameters(ssrc_, parameters); |
| 77 } |
| 78 |
69 void AudioRtpReceiver::Reconfigure() { | 79 void AudioRtpReceiver::Reconfigure() { |
70 if (!provider_) { | 80 if (!provider_) { |
71 return; | 81 return; |
72 } | 82 } |
73 provider_->SetAudioPlayout(ssrc_, track_->enabled()); | 83 provider_->SetAudioPlayout(ssrc_, track_->enabled()); |
74 } | 84 } |
75 | 85 |
76 VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream, | 86 VideoRtpReceiver::VideoRtpReceiver(MediaStreamInterface* stream, |
77 const std::string& track_id, | 87 const std::string& track_id, |
78 rtc::Thread* worker_thread, | 88 rtc::Thread* worker_thread, |
(...skipping 27 matching lines...) Expand all Loading... |
106 // TODO(deadbeef): Need to do more here to fully stop receiving packets. | 116 // TODO(deadbeef): Need to do more here to fully stop receiving packets. |
107 if (!provider_) { | 117 if (!provider_) { |
108 return; | 118 return; |
109 } | 119 } |
110 source_->SetState(MediaSourceInterface::kEnded); | 120 source_->SetState(MediaSourceInterface::kEnded); |
111 source_->OnSourceDestroyed(); | 121 source_->OnSourceDestroyed(); |
112 provider_->SetVideoPlayout(ssrc_, false, nullptr); | 122 provider_->SetVideoPlayout(ssrc_, false, nullptr); |
113 provider_ = nullptr; | 123 provider_ = nullptr; |
114 } | 124 } |
115 | 125 |
| 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 |
116 } // namespace webrtc | 135 } // namespace webrtc |
OLD | NEW |