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

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

Issue 2675173003: Adding "adapter" ORTC objects on top of ChannelManager/BaseChannel/etc. (Closed)
Patch Set: Move ORTC files to different subdirectories Created 3 years, 10 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
« no previous file with comments | « webrtc/pc/rtcstatscollector_unittest.cc ('k') | webrtc/pc/rtpreceiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
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 // Internal class used by PeerConnection. 33 // Internal class used by PeerConnection.
34 class RtpReceiverInternal : public RtpReceiverInterface { 34 class RtpReceiverInternal : public RtpReceiverInterface {
35 public: 35 public:
36 virtual void Stop() = 0; 36 virtual void Stop() = 0;
37 virtual uint32_t ssrc() const = 0;
pthatcher1 2017/02/09 00:11:44 Can you leave a comment about what this is and why
Taylor Brandstetter 2017/02/10 00:19:46 Done.
37 }; 38 };
38 39
39 class AudioRtpReceiver : public ObserverInterface, 40 class AudioRtpReceiver : public ObserverInterface,
40 public AudioSourceInterface::AudioObserver, 41 public AudioSourceInterface::AudioObserver,
41 public rtc::RefCountedObject<RtpReceiverInternal>, 42 public rtc::RefCountedObject<RtpReceiverInternal>,
42 public sigslot::has_slots<> { 43 public sigslot::has_slots<> {
43 public: 44 public:
44 AudioRtpReceiver(MediaStreamInterface* stream, 45 // An SSRC of 0 will create a receiver that will match the first SSRC it
45 const std::string& track_id, 46 // sees.
pthatcher1 2017/02/09 00:11:44 Instead of making a comment like this, could we do
Taylor Brandstetter 2017/02/10 00:19:46 We could do that, I was just trying to change as f
47 AudioRtpReceiver(const std::string& track_id,
46 uint32_t ssrc, 48 uint32_t ssrc,
47 cricket::VoiceChannel* channel); 49 cricket::VoiceChannel* channel);
48 50
49 virtual ~AudioRtpReceiver(); 51 virtual ~AudioRtpReceiver();
50 52
51 // ObserverInterface implementation 53 // ObserverInterface implementation
52 void OnChanged() override; 54 void OnChanged() override;
53 55
54 // AudioSourceInterface::AudioObserver implementation 56 // AudioSourceInterface::AudioObserver implementation
55 void OnSetVolume(double volume) override; 57 void OnSetVolume(double volume) override;
(...skipping 11 matching lines...) Expand all
67 return cricket::MEDIA_TYPE_AUDIO; 69 return cricket::MEDIA_TYPE_AUDIO;
68 } 70 }
69 71
70 std::string id() const override { return id_; } 72 std::string id() const override { return id_; }
71 73
72 RtpParameters GetParameters() const override; 74 RtpParameters GetParameters() const override;
73 bool SetParameters(const RtpParameters& parameters) override; 75 bool SetParameters(const RtpParameters& parameters) override;
74 76
75 // RtpReceiverInternal implementation. 77 // RtpReceiverInternal implementation.
76 void Stop() override; 78 void Stop() override;
79 uint32_t ssrc() const override { return ssrc_; }
77 80
78 void SetObserver(RtpReceiverObserverInterface* observer) override; 81 void SetObserver(RtpReceiverObserverInterface* observer) override;
79 82
80 // Does not take ownership. 83 // Does not take ownership.
81 // Should call SetChannel(nullptr) before |channel| is destroyed. 84 // Should call SetChannel(nullptr) before |channel| is destroyed.
82 void SetChannel(cricket::VoiceChannel* channel); 85 void SetChannel(cricket::VoiceChannel* channel);
83 86
84 private: 87 private:
85 void Reconfigure(); 88 void Reconfigure();
86 void OnFirstPacketReceived(cricket::BaseChannel* channel); 89 void OnFirstPacketReceived(cricket::BaseChannel* channel);
87 90
88 const std::string id_; 91 const std::string id_;
89 const uint32_t ssrc_; 92 const uint32_t ssrc_;
90 cricket::VoiceChannel* channel_; 93 cricket::VoiceChannel* channel_;
91 const rtc::scoped_refptr<AudioTrackInterface> track_; 94 const rtc::scoped_refptr<AudioTrackInterface> track_;
92 bool cached_track_enabled_; 95 bool cached_track_enabled_;
93 double cached_volume_ = 1; 96 double cached_volume_ = 1;
94 bool stopped_ = false; 97 bool stopped_ = false;
95 RtpReceiverObserverInterface* observer_ = nullptr; 98 RtpReceiverObserverInterface* observer_ = nullptr;
96 bool received_first_packet_ = false; 99 bool received_first_packet_ = false;
97 }; 100 };
98 101
99 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>, 102 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>,
100 public sigslot::has_slots<> { 103 public sigslot::has_slots<> {
101 public: 104 public:
102 VideoRtpReceiver(MediaStreamInterface* stream, 105 // An SSRC of 0 will create a receiver that will match the first SSRC it
103 const std::string& track_id, 106 // sees.
107 VideoRtpReceiver(const std::string& track_id,
104 rtc::Thread* worker_thread, 108 rtc::Thread* worker_thread,
105 uint32_t ssrc, 109 uint32_t ssrc,
106 cricket::VideoChannel* channel); 110 cricket::VideoChannel* channel);
107 111
108 virtual ~VideoRtpReceiver(); 112 virtual ~VideoRtpReceiver();
109 113
110 rtc::scoped_refptr<VideoTrackInterface> video_track() const { 114 rtc::scoped_refptr<VideoTrackInterface> video_track() const {
111 return track_.get(); 115 return track_.get();
112 } 116 }
113 117
114 // RtpReceiverInterface implementation 118 // RtpReceiverInterface implementation
115 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { 119 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
116 return track_.get(); 120 return track_.get();
117 } 121 }
118 122
119 cricket::MediaType media_type() const override { 123 cricket::MediaType media_type() const override {
120 return cricket::MEDIA_TYPE_VIDEO; 124 return cricket::MEDIA_TYPE_VIDEO;
121 } 125 }
122 126
123 std::string id() const override { return id_; } 127 std::string id() const override { return id_; }
124 128
125 RtpParameters GetParameters() const override; 129 RtpParameters GetParameters() const override;
126 bool SetParameters(const RtpParameters& parameters) override; 130 bool SetParameters(const RtpParameters& parameters) override;
127 131
128 // RtpReceiverInternal implementation. 132 // RtpReceiverInternal implementation.
129 void Stop() override; 133 void Stop() override;
134 uint32_t ssrc() const override { return ssrc_; }
130 135
131 void SetObserver(RtpReceiverObserverInterface* observer) override; 136 void SetObserver(RtpReceiverObserverInterface* observer) override;
132 137
133 // Does not take ownership. 138 // Does not take ownership.
134 // Should call SetChannel(nullptr) before |channel| is destroyed. 139 // Should call SetChannel(nullptr) before |channel| is destroyed.
135 void SetChannel(cricket::VideoChannel* channel); 140 void SetChannel(cricket::VideoChannel* channel);
136 141
137 private: 142 private:
138 void OnFirstPacketReceived(cricket::BaseChannel* channel); 143 void OnFirstPacketReceived(cricket::BaseChannel* channel);
139 144
140 std::string id_; 145 std::string id_;
141 uint32_t ssrc_; 146 uint32_t ssrc_;
142 cricket::VideoChannel* channel_; 147 cricket::VideoChannel* channel_;
143 // |broadcaster_| is needed since the decoder can only handle one sink. 148 // |broadcaster_| is needed since the decoder can only handle one sink.
144 // It might be better if the decoder can handle multiple sinks and consider 149 // It might be better if the decoder can handle multiple sinks and consider
145 // the VideoSinkWants. 150 // the VideoSinkWants.
146 rtc::VideoBroadcaster broadcaster_; 151 rtc::VideoBroadcaster broadcaster_;
147 // |source_| is held here to be able to change the state of the source when 152 // |source_| is held here to be able to change the state of the source when
148 // the VideoRtpReceiver is stopped. 153 // the VideoRtpReceiver is stopped.
149 rtc::scoped_refptr<VideoTrackSource> source_; 154 rtc::scoped_refptr<VideoTrackSource> source_;
150 rtc::scoped_refptr<VideoTrackInterface> track_; 155 rtc::scoped_refptr<VideoTrackInterface> track_;
151 bool stopped_ = false; 156 bool stopped_ = false;
152 RtpReceiverObserverInterface* observer_ = nullptr; 157 RtpReceiverObserverInterface* observer_ = nullptr;
153 bool received_first_packet_ = false; 158 bool received_first_packet_ = false;
154 }; 159 };
155 160
156 } // namespace webrtc 161 } // namespace webrtc
157 162
158 #endif // WEBRTC_PC_RTPRECEIVER_H_ 163 #endif // WEBRTC_PC_RTPRECEIVER_H_
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstatscollector_unittest.cc ('k') | webrtc/pc/rtpreceiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698