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

Side by Side Diff: webrtc/pc/rtpreceiver.cc

Issue 2770233003: Implemented the GetSources() in native code. (Closed)
Patch Set: Merge and add the tests. Created 3 years, 8 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
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
11 #include "webrtc/pc/rtpreceiver.h" 11 #include "webrtc/pc/rtpreceiver.h"
12 12
13 #include "webrtc/api/mediastreamtrackproxy.h" 13 #include "webrtc/api/mediastreamtrackproxy.h"
14 #include "webrtc/api/videosourceproxy.h" 14 #include "webrtc/api/videosourceproxy.h"
15 #include "webrtc/base/ptr_util.h"
15 #include "webrtc/base/trace_event.h" 16 #include "webrtc/base/trace_event.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
16 #include "webrtc/pc/audiotrack.h" 18 #include "webrtc/pc/audiotrack.h"
17 #include "webrtc/pc/videotrack.h" 19 #include "webrtc/pc/videotrack.h"
18 20
19 namespace webrtc { 21 namespace webrtc {
20 22
21 AudioRtpReceiver::AudioRtpReceiver(const std::string& track_id, 23 AudioRtpReceiver::AudioRtpReceiver(const std::string& track_id,
22 uint32_t ssrc, 24 uint32_t ssrc,
23 cricket::VoiceChannel* channel) 25 cricket::VoiceChannel* channel)
24 : id_(track_id), 26 : id_(track_id),
25 ssrc_(ssrc), 27 ssrc_(ssrc),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return; 92 return;
91 } 93 }
92 if (channel_) { 94 if (channel_) {
93 // Allow that SetOutputVolume fail. This is the normal case when the 95 // Allow that SetOutputVolume fail. This is the normal case when the
94 // underlying media channel has already been deleted. 96 // underlying media channel has already been deleted.
95 channel_->SetOutputVolume(ssrc_, 0); 97 channel_->SetOutputVolume(ssrc_, 0);
96 } 98 }
97 stopped_ = true; 99 stopped_ = true;
98 } 100 }
99 101
102 std::vector<std::unique_ptr<RtpContributingSourceInterface>>
103 AudioRtpReceiver::GetContributingSources() {
104 std::vector<std::unique_ptr<RtpContributingSourceInterface>>
105 contributing_sources;
106 auto sources = channel_->GetContributingSources(ssrc_);
the sun 2017/03/30 11:31:42 Note, you can add the ssrc entry here and avoid pr
Taylor Brandstetter 2017/03/30 22:55:38 But the AudioRtpReceiver only knows about the SSRC
the sun 2017/03/31 07:05:42 Hmm. Thanks for bringing this up. When does it hap
107 for (auto source : sources) {
108 contributing_sources.push_back(
109 rtc::MakeUnique<RtpContributingSource>(*source));
110 }
111 return contributing_sources;
112 }
113
100 void AudioRtpReceiver::Reconfigure() { 114 void AudioRtpReceiver::Reconfigure() {
101 RTC_DCHECK(!stopped_); 115 RTC_DCHECK(!stopped_);
102 if (!channel_) { 116 if (!channel_) {
103 LOG(LS_ERROR) << "AudioRtpReceiver::Reconfigure: No audio channel exists."; 117 LOG(LS_ERROR) << "AudioRtpReceiver::Reconfigure: No audio channel exists.";
104 return; 118 return;
105 } 119 }
106 if (!channel_->SetOutputVolume(ssrc_, 120 if (!channel_->SetOutputVolume(ssrc_,
107 track_->enabled() ? cached_volume_ : 0)) { 121 track_->enabled() ? cached_volume_ : 0)) {
108 RTC_NOTREACHED(); 122 RTC_NOTREACHED();
109 } 123 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 243 }
230 244
231 void VideoRtpReceiver::OnFirstPacketReceived(cricket::BaseChannel* channel) { 245 void VideoRtpReceiver::OnFirstPacketReceived(cricket::BaseChannel* channel) {
232 if (observer_) { 246 if (observer_) {
233 observer_->OnFirstPacketReceived(media_type()); 247 observer_->OnFirstPacketReceived(media_type());
234 } 248 }
235 received_first_packet_ = true; 249 received_first_packet_ = true;
236 } 250 }
237 251
238 } // namespace webrtc 252 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698