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

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

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
(...skipping 12 matching lines...) Expand all
23 #include "webrtc/api/rtpreceiverinterface.h" 23 #include "webrtc/api/rtpreceiverinterface.h"
24 #include "webrtc/base/basictypes.h" 24 #include "webrtc/base/basictypes.h"
25 #include "webrtc/base/sigslot.h" 25 #include "webrtc/base/sigslot.h"
26 #include "webrtc/media/base/videobroadcaster.h" 26 #include "webrtc/media/base/videobroadcaster.h"
27 #include "webrtc/pc/channel.h" 27 #include "webrtc/pc/channel.h"
28 #include "webrtc/pc/remoteaudiosource.h" 28 #include "webrtc/pc/remoteaudiosource.h"
29 #include "webrtc/pc/videotracksource.h" 29 #include "webrtc/pc/videotracksource.h"
30 30
31 namespace webrtc { 31 namespace webrtc {
32 32
33 class RtpContributingSource;
34
33 // Internal class used by PeerConnection. 35 // Internal class used by PeerConnection.
34 class RtpReceiverInternal : public RtpReceiverInterface { 36 class RtpReceiverInternal : public RtpReceiverInterface {
35 public: 37 public:
36 virtual void Stop() = 0; 38 virtual void Stop() = 0;
37 // This SSRC is used as an identifier for the receiver between the API layer 39 // This SSRC is used as an identifier for the receiver between the API layer
38 // and the WebRtcVideoEngine2, WebRtcVoiceEngine layer. 40 // and the WebRtcVideoEngine2, WebRtcVoiceEngine layer.
39 virtual uint32_t ssrc() const = 0; 41 virtual uint32_t ssrc() const = 0;
42
43 // TODO(zhihuang): Remove the default implemenation once the subclasses
Taylor Brandstetter 2017/03/30 22:55:38 nit: Spelling of "implementation" Also, isn't the
Zhi Huang 2017/03/31 06:44:05 Done.
44 // implement this.
45 virtual std::vector<std::unique_ptr<RtpContributingSourceInterface>>
46 GetContributingSources() {
47 return std::vector<std::unique_ptr<RtpContributingSourceInterface>>();
48 }
40 }; 49 };
41 50
42 class AudioRtpReceiver : public ObserverInterface, 51 class AudioRtpReceiver : public ObserverInterface,
43 public AudioSourceInterface::AudioObserver, 52 public AudioSourceInterface::AudioObserver,
44 public rtc::RefCountedObject<RtpReceiverInternal>, 53 public rtc::RefCountedObject<RtpReceiverInternal>,
45 public sigslot::has_slots<> { 54 public sigslot::has_slots<> {
46 public: 55 public:
47 // An SSRC of 0 will create a receiver that will match the first SSRC it 56 // An SSRC of 0 will create a receiver that will match the first SSRC it
48 // sees. 57 // sees.
49 // TODO(deadbeef): Use rtc::Optional, or have another constructor that 58 // TODO(deadbeef): Use rtc::Optional, or have another constructor that
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // RtpReceiverInternal implementation. 90 // RtpReceiverInternal implementation.
82 void Stop() override; 91 void Stop() override;
83 uint32_t ssrc() const override { return ssrc_; } 92 uint32_t ssrc() const override { return ssrc_; }
84 93
85 void SetObserver(RtpReceiverObserverInterface* observer) override; 94 void SetObserver(RtpReceiverObserverInterface* observer) override;
86 95
87 // Does not take ownership. 96 // Does not take ownership.
88 // Should call SetChannel(nullptr) before |channel| is destroyed. 97 // Should call SetChannel(nullptr) before |channel| is destroyed.
89 void SetChannel(cricket::VoiceChannel* channel); 98 void SetChannel(cricket::VoiceChannel* channel);
90 99
100 std::vector<std::unique_ptr<RtpContributingSourceInterface>>
101 GetContributingSources() override;
102
91 private: 103 private:
92 void Reconfigure(); 104 void Reconfigure();
93 void OnFirstPacketReceived(cricket::BaseChannel* channel); 105 void OnFirstPacketReceived(cricket::BaseChannel* channel);
94 106
95 const std::string id_; 107 const std::string id_;
96 const uint32_t ssrc_; 108 const uint32_t ssrc_;
97 cricket::VoiceChannel* channel_; 109 cricket::VoiceChannel* channel_;
98 const rtc::scoped_refptr<AudioTrackInterface> track_; 110 const rtc::scoped_refptr<AudioTrackInterface> track_;
99 bool cached_track_enabled_; 111 bool cached_track_enabled_;
100 double cached_volume_ = 1; 112 double cached_volume_ = 1;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 rtc::scoped_refptr<VideoTrackSource> source_; 170 rtc::scoped_refptr<VideoTrackSource> source_;
159 rtc::scoped_refptr<VideoTrackInterface> track_; 171 rtc::scoped_refptr<VideoTrackInterface> track_;
160 bool stopped_ = false; 172 bool stopped_ = false;
161 RtpReceiverObserverInterface* observer_ = nullptr; 173 RtpReceiverObserverInterface* observer_ = nullptr;
162 bool received_first_packet_ = false; 174 bool received_first_packet_ = false;
163 }; 175 };
164 176
165 } // namespace webrtc 177 } // namespace webrtc
166 178
167 #endif // WEBRTC_PC_RTPRECEIVER_H_ 179 #endif // WEBRTC_PC_RTPRECEIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698