blob: 70a9c947aa6c266b4a2ce5913dbb65890d73784e [file] [log] [blame]
ossu7bb87ee2017-01-23 12:56:251/*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11// This file contains classes that implement RtpSenderInterface.
12// An RtpSender associates a MediaStreamTrackInterface with an underlying
13// transport (provided by AudioProviderInterface/VideoProviderInterface)
14
Steve Anton10542f22019-01-11 17:11:0015#ifndef PC_RTP_SENDER_H_
16#define PC_RTP_SENDER_H_
ossu7bb87ee2017-01-23 12:56:2517
Harald Alvestrand5761e7b2021-01-29 14:45:0818#include <stddef.h>
19#include <stdint.h>
Harald Alvestrandc24a2182022-02-23 13:44:5920
ossu7bb87ee2017-01-23 12:56:2521#include <memory>
22#include <string>
Steve Anton36b29d12017-10-30 16:57:4223#include <vector>
ossu7bb87ee2017-01-23 12:56:2524
Harald Alvestrand5761e7b2021-01-29 14:45:0825#include "absl/types/optional.h"
26#include "api/crypto/frame_encryptor_interface.h"
27#include "api/dtls_transport_interface.h"
28#include "api/dtmf_sender_interface.h"
29#include "api/frame_transformer_interface.h"
Steve Anton10542f22019-01-11 17:11:0030#include "api/media_stream_interface.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0831#include "api/media_types.h"
32#include "api/rtc_error.h"
33#include "api/rtp_parameters.h"
Steve Anton10542f22019-01-11 17:11:0034#include "api/rtp_sender_interface.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0835#include "api/scoped_refptr.h"
Harald Alvestrandc24a2182022-02-23 13:44:5936#include "api/sequence_checker.h"
Steve Anton10542f22019-01-11 17:11:0037#include "media/base/audio_source.h"
38#include "media/base/media_channel.h"
39#include "pc/dtmf_sender.h"
Henrik Boströmf7859892022-07-04 12:36:3740#include "pc/legacy_stats_collector_interface.h"
Harald Alvestrandc24a2182022-02-23 13:44:5941#include "rtc_base/checks.h"
Markus Handell6fcd0f82020-07-07 17:08:5342#include "rtc_base/synchronization/mutex.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0843#include "rtc_base/thread.h"
Harald Alvestrandc24a2182022-02-23 13:44:5944#include "rtc_base/thread_annotations.h"
ossu7bb87ee2017-01-23 12:56:2545
46namespace webrtc {
47
Florent Castelli892acf02018-10-01 20:47:2048bool UnimplementedRtpParameterHasValue(const RtpParameters& parameters);
49
ossu7bb87ee2017-01-23 12:56:2550// Internal interface used by PeerConnection.
51class RtpSenderInternal : public RtpSenderInterface {
52 public:
Steve Anton57858b32018-02-15 23:19:5053 // Sets the underlying MediaEngine channel associated with this RtpSender.
Amit Hilbuchdd9390c2018-11-14 00:26:0554 // A VoiceMediaChannel should be used for audio RtpSenders and
55 // a VideoMediaChannel should be used for video RtpSenders.
56 // Must call SetMediaChannel(nullptr) before the media channel is destroyed.
57 virtual void SetMediaChannel(cricket::MediaChannel* media_channel) = 0;
Steve Anton57858b32018-02-15 23:19:5058
ossu7bb87ee2017-01-23 12:56:2559 // Used to set the SSRC of the sender, once a local description has been set.
Artem Titov880fa812021-07-30 20:30:2360 // If `ssrc` is 0, this indiates that the sender should disconnect from the
ossu7bb87ee2017-01-23 12:56:2561 // underlying transport (this occurs if the sender isn't seen in a local
62 // description).
63 virtual void SetSsrc(uint32_t ssrc) = 0;
64
Henrik Andreasssoncc189172019-05-20 09:01:3865 virtual void set_stream_ids(const std::vector<std::string>& stream_ids) = 0;
Florent Castelli892acf02018-10-01 20:47:2066 virtual void set_init_send_encodings(
67 const std::vector<RtpEncodingParameters>& init_send_encodings) = 0;
Harald Alvestrand4a7b3ac2019-01-17 09:39:4068 virtual void set_transport(
69 rtc::scoped_refptr<DtlsTransportInterface> dtls_transport) = 0;
ossu7bb87ee2017-01-23 12:56:2570
71 virtual void Stop() = 0;
Steve Anton57858b32018-02-15 23:19:5072
Artem Titov880fa812021-07-30 20:30:2373 // `GetParameters` and `SetParameters` operate with a transactional model.
Amit Hilbuch619b2942019-02-26 23:55:1974 // Allow access to get/set parameters without invalidating transaction id.
75 virtual RtpParameters GetParametersInternal() const = 0;
76 virtual RTCError SetParametersInternal(const RtpParameters& parameters) = 0;
77
Harald Alvestrand0166be82022-08-25 11:31:0178 // GetParameters and SetParameters will remove deactivated simulcast layers
79 // and restore them on SetParameters. This is probably a Bad Idea, but we
80 // do not know who depends on this behavior
81 virtual RtpParameters GetParametersInternalWithAllLayers() const = 0;
82 virtual RTCError SetParametersInternalWithAllLayers(
83 const RtpParameters& parameters) = 0;
84
Florent Castelli725ee242022-10-18 15:05:5885 // Additional checks that are specific to the Sender type
86 virtual RTCError CheckSVCParameters(const RtpParameters& parameters) {
87 return webrtc::RTCError::OK();
88 }
89
Steve Anton57858b32018-02-15 23:19:5090 // Returns an ID that changes every time SetTrack() is called, but
91 // otherwise remains constant. Used to generate IDs for stats.
92 // The special value zero means that no track is attached.
93 virtual int AttachmentId() const = 0;
Amit Hilbuch2297d332019-02-19 20:49:2294
95 // Disables the layers identified by the specified RIDs.
96 // If the specified list is empty, this is a no-op.
97 virtual RTCError DisableEncodingLayers(
98 const std::vector<std::string>& rid) = 0;
Harald Alvestrand6060df52020-08-11 07:54:0299
100 virtual void SetTransceiverAsStopped() = 0;
Florent Castelli725ee242022-10-18 15:05:58101
102 // Used by the owning transceiver to inform the sender on the currently
103 // selected codecs.
104 virtual void SetVideoCodecPreferences(
105 std::vector<cricket::VideoCodec> codec_preferences) = 0;
ossu7bb87ee2017-01-23 12:56:25106};
107
Amit Hilbuchea7ef2a2019-02-19 23:20:21108// Shared implementation for RtpSenderInternal interface.
109class RtpSenderBase : public RtpSenderInternal, public ObserverInterface {
110 public:
Guido Urdaneta1ff16c82019-05-20 17:31:53111 class SetStreamsObserver {
112 public:
113 virtual ~SetStreamsObserver() = default;
114 virtual void OnSetStreams() = 0;
115 };
116
Amit Hilbuchea7ef2a2019-02-19 23:20:21117 // Sets the underlying MediaEngine channel associated with this RtpSender.
118 // A VoiceMediaChannel should be used for audio RtpSenders and
119 // a VideoMediaChannel should be used for video RtpSenders.
120 // Must call SetMediaChannel(nullptr) before the media channel is destroyed.
121 void SetMediaChannel(cricket::MediaChannel* media_channel) override;
122
123 bool SetTrack(MediaStreamTrackInterface* track) override;
124 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
Tomas Gunnarssonfe328ca2022-02-16 19:02:12125 // This method is currently called from the worker thread by
126 // RTCStatsCollector::PrepareTransceiverStatsInfosAndCallStats_s_w_n.
127 // RTC_DCHECK_RUN_ON(signaling_thread_);
Amit Hilbuchea7ef2a2019-02-19 23:20:21128 return track_;
129 }
130
131 RtpParameters GetParameters() const override;
132 RTCError SetParameters(const RtpParameters& parameters) override;
133
Artem Titov880fa812021-07-30 20:30:23134 // `GetParameters` and `SetParameters` operate with a transactional model.
Amit Hilbuch619b2942019-02-26 23:55:19135 // Allow access to get/set parameters without invalidating transaction id.
136 RtpParameters GetParametersInternal() const override;
137 RTCError SetParametersInternal(const RtpParameters& parameters) override;
Harald Alvestrand0166be82022-08-25 11:31:01138 RtpParameters GetParametersInternalWithAllLayers() const override;
139 RTCError SetParametersInternalWithAllLayers(
140 const RtpParameters& parameters) override;
Amit Hilbuch619b2942019-02-26 23:55:19141
Amit Hilbuchea7ef2a2019-02-19 23:20:21142 // Used to set the SSRC of the sender, once a local description has been set.
Artem Titov880fa812021-07-30 20:30:23143 // If `ssrc` is 0, this indiates that the sender should disconnect from the
Amit Hilbuchea7ef2a2019-02-19 23:20:21144 // underlying transport (this occurs if the sender isn't seen in a local
145 // description).
146 void SetSsrc(uint32_t ssrc) override;
Tomas Gunnarssonfe328ca2022-02-16 19:02:12147 uint32_t ssrc() const override {
148 // This method is currently called from the worker thread by
149 // RTCStatsCollector::PrepareTransceiverStatsInfosAndCallStats_s_w_n.
150 // RTC_DCHECK_RUN_ON(signaling_thread_);
151 return ssrc_;
152 }
Amit Hilbuchea7ef2a2019-02-19 23:20:21153
Tomas Gunnarssonfe328ca2022-02-16 19:02:12154 std::vector<std::string> stream_ids() const override {
155 RTC_DCHECK_RUN_ON(signaling_thread_);
156 return stream_ids_;
157 }
Henrik Andreasssoncc189172019-05-20 09:01:38158 void set_stream_ids(const std::vector<std::string>& stream_ids) override {
159 stream_ids_ = stream_ids;
160 }
Guido Urdaneta1ff16c82019-05-20 17:31:53161 void SetStreams(const std::vector<std::string>& stream_ids) override;
Amit Hilbuchea7ef2a2019-02-19 23:20:21162
163 std::string id() const override { return id_; }
164
165 void set_init_send_encodings(
166 const std::vector<RtpEncodingParameters>& init_send_encodings) override {
167 init_parameters_.encodings = init_send_encodings;
168 }
169 std::vector<RtpEncodingParameters> init_send_encodings() const override {
Tomas Gunnarssonfe328ca2022-02-16 19:02:12170 RTC_DCHECK_RUN_ON(signaling_thread_);
Amit Hilbuchea7ef2a2019-02-19 23:20:21171 return init_parameters_.encodings;
172 }
173
174 void set_transport(
175 rtc::scoped_refptr<DtlsTransportInterface> dtls_transport) override {
176 dtls_transport_ = dtls_transport;
177 }
178 rtc::scoped_refptr<DtlsTransportInterface> dtls_transport() const override {
Tomas Gunnarssonfe328ca2022-02-16 19:02:12179 RTC_DCHECK_RUN_ON(signaling_thread_);
Amit Hilbuchea7ef2a2019-02-19 23:20:21180 return dtls_transport_;
181 }
182
183 void SetFrameEncryptor(
184 rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor) override;
185
186 rtc::scoped_refptr<FrameEncryptorInterface> GetFrameEncryptor()
187 const override {
188 return frame_encryptor_;
189 }
190
191 void Stop() override;
192
193 // Returns an ID that changes every time SetTrack() is called, but
194 // otherwise remains constant. Used to generate IDs for stats.
195 // The special value zero means that no track is attached.
196 int AttachmentId() const override { return attachment_id_; }
197
198 // Disables the layers identified by the specified RIDs.
199 // If the specified list is empty, this is a no-op.
200 RTCError DisableEncodingLayers(const std::vector<std::string>& rid) override;
201
Marina Cioceae77912b2020-02-27 15:16:55202 void SetEncoderToPacketizerFrameTransformer(
203 rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) override;
204
Jonas Oreland65455162022-06-08 09:25:46205 void SetEncoderSelector(
206 std::unique_ptr<VideoEncoderFactory::EncoderSelectorInterface>
207 encoder_selector) override;
208
209 void SetEncoderSelectorOnChannel();
210
Tomas Gunnarssonfe328ca2022-02-16 19:02:12211 void SetTransceiverAsStopped() override {
212 RTC_DCHECK_RUN_ON(signaling_thread_);
213 is_transceiver_stopped_ = true;
214 }
Harald Alvestrand6060df52020-08-11 07:54:02215
Florent Castelli725ee242022-10-18 15:05:58216 void SetVideoCodecPreferences(
217 std::vector<cricket::VideoCodec> codec_preferences) override {
218 video_codec_preferences_ = codec_preferences;
219 }
220
Amit Hilbuchea7ef2a2019-02-19 23:20:21221 protected:
Artem Titov880fa812021-07-30 20:30:23222 // If `set_streams_observer` is not null, it is invoked when SetStreams()
223 // is called. `set_streams_observer` is not owned by this object. If not
Guido Urdaneta1ff16c82019-05-20 17:31:53224 // null, it must be valid at least until this sender becomes stopped.
225 RtpSenderBase(rtc::Thread* worker_thread,
226 const std::string& id,
227 SetStreamsObserver* set_streams_observer);
Niels Möllerb5b159d2022-07-05 07:59:27228 // TODO(bugs.webrtc.org/8694): Since SSRC == 0 is technically valid, figure
229 // out some other way to test if we have a valid SSRC.
Amit Hilbuchea7ef2a2019-02-19 23:20:21230 bool can_send_track() const { return track_ && ssrc_; }
231
232 virtual std::string track_kind() const = 0;
233
234 // Enable sending on the media channel.
235 virtual void SetSend() = 0;
236 // Disable sending on the media channel.
237 virtual void ClearSend() = 0;
238
239 // Template method pattern to allow subclasses to add custom behavior for
240 // when tracks are attached, detached, and for adding tracks to statistics.
241 virtual void AttachTrack() {}
242 virtual void DetachTrack() {}
243 virtual void AddTrackToStats() {}
244 virtual void RemoveTrackFromStats() {}
245
Tomas Gunnarssonfe328ca2022-02-16 19:02:12246 rtc::Thread* const signaling_thread_;
247 rtc::Thread* const worker_thread_;
Amit Hilbuchea7ef2a2019-02-19 23:20:21248 uint32_t ssrc_ = 0;
Tomas Gunnarssonfe328ca2022-02-16 19:02:12249 bool stopped_ RTC_GUARDED_BY(signaling_thread_) = false;
250 bool is_transceiver_stopped_ RTC_GUARDED_BY(signaling_thread_) = false;
Amit Hilbuchea7ef2a2019-02-19 23:20:21251 int attachment_id_ = 0;
252 const std::string id_;
253
254 std::vector<std::string> stream_ids_;
255 RtpParameters init_parameters_;
Florent Castelli725ee242022-10-18 15:05:58256 std::vector<cricket::VideoCodec> video_codec_preferences_;
Amit Hilbuchea7ef2a2019-02-19 23:20:21257
Tommi6589def2022-02-17 22:36:47258 // TODO(tommi): `media_channel_` and several other member variables in this
259 // class (ssrc_, stopped_, etc) are accessed from more than one thread without
260 // a guard or lock. Internally there are also several Invoke()s that we could
261 // remove since the upstream code may already be performing several operations
262 // on the worker thread.
Amit Hilbuchea7ef2a2019-02-19 23:20:21263 cricket::MediaChannel* media_channel_ = nullptr;
264 rtc::scoped_refptr<MediaStreamTrackInterface> track_;
265
266 rtc::scoped_refptr<DtlsTransportInterface> dtls_transport_;
267 rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor_;
Artem Titov880fa812021-07-30 20:30:23268 // `last_transaction_id_` is used to verify that `SetParameters` is receiving
269 // the parameters object that was last returned from `GetParameters`.
Amit Hilbuchea7ef2a2019-02-19 23:20:21270 // As such, it is used for internal verification and is not observable by the
Artem Titov880fa812021-07-30 20:30:23271 // the client. It is marked as mutable to enable `GetParameters` to be a
Amit Hilbuchea7ef2a2019-02-19 23:20:21272 // const method.
273 mutable absl::optional<std::string> last_transaction_id_;
274 std::vector<std::string> disabled_rids_;
Guido Urdaneta1ff16c82019-05-20 17:31:53275
276 SetStreamsObserver* set_streams_observer_ = nullptr;
Marina Cioceae77912b2020-02-27 15:16:55277
278 rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_;
Jonas Oreland65455162022-06-08 09:25:46279 std::unique_ptr<VideoEncoderFactory::EncoderSelectorInterface>
280 encoder_selector_;
Amit Hilbuchea7ef2a2019-02-19 23:20:21281};
282
ossu7bb87ee2017-01-23 12:56:25283// LocalAudioSinkAdapter receives data callback as a sink to the local
284// AudioTrack, and passes the data to the sink of AudioSource.
285class LocalAudioSinkAdapter : public AudioTrackSinkInterface,
286 public cricket::AudioSource {
287 public:
288 LocalAudioSinkAdapter();
289 virtual ~LocalAudioSinkAdapter();
290
291 private:
292 // AudioSinkInterface implementation.
293 void OnData(const void* audio_data,
294 int bits_per_sample,
295 int sample_rate,
296 size_t number_of_channels,
Minyue Li99d6d812020-01-29 09:25:12297 size_t number_of_frames,
298 absl::optional<int64_t> absolute_capture_timestamp_ms) override;
299
300 // AudioSinkInterface implementation.
301 void OnData(const void* audio_data,
302 int bits_per_sample,
303 int sample_rate,
304 size_t number_of_channels,
305 size_t number_of_frames) override {
306 OnData(audio_data, bits_per_sample, sample_rate, number_of_channels,
307 number_of_frames,
308 /*absolute_capture_timestamp_ms=*/absl::nullopt);
309 }
ossu7bb87ee2017-01-23 12:56:25310
Gustaf Ullberg46ea5d72020-12-15 14:12:16311 // AudioSinkInterface implementation.
312 int NumPreferredChannels() const override { return num_preferred_channels_; }
313
ossu7bb87ee2017-01-23 12:56:25314 // cricket::AudioSource implementation.
315 void SetSink(cricket::AudioSource::Sink* sink) override;
316
317 cricket::AudioSource::Sink* sink_;
Artem Titov880fa812021-07-30 20:30:23318 // Critical section protecting `sink_`.
Markus Handell6fcd0f82020-07-07 17:08:53319 Mutex lock_;
Gustaf Ullberg46ea5d72020-12-15 14:12:16320 int num_preferred_channels_ = -1;
ossu7bb87ee2017-01-23 12:56:25321};
322
Amit Hilbuchea7ef2a2019-02-19 23:20:21323class AudioRtpSender : public DtmfProviderInterface, public RtpSenderBase {
ossu7bb87ee2017-01-23 12:56:25324 public:
Steve Anton111fdfd2018-06-25 20:03:36325 // Construct an RtpSender for audio with the given sender ID.
326 // The sender is initialized with no track to send and no associated streams.
Amit Hilbuchea7ef2a2019-02-19 23:20:21327 // StatsCollector provided so that Add/RemoveLocalAudioTrack can be called
328 // at the appropriate times.
Artem Titov880fa812021-07-30 20:30:23329 // If `set_streams_observer` is not null, it is invoked when SetStreams()
330 // is called. `set_streams_observer` is not owned by this object. If not
Guido Urdaneta1ff16c82019-05-20 17:31:53331 // null, it must be valid at least until this sender becomes stopped.
332 static rtc::scoped_refptr<AudioRtpSender> Create(
333 rtc::Thread* worker_thread,
334 const std::string& id,
Henrik Boströmf7859892022-07-04 12:36:37335 LegacyStatsCollectorInterface* stats,
Guido Urdaneta1ff16c82019-05-20 17:31:53336 SetStreamsObserver* set_streams_observer);
ossu7bb87ee2017-01-23 12:56:25337 virtual ~AudioRtpSender();
338
deadbeef20cb0c12017-02-02 04:27:00339 // DtmfSenderProvider implementation.
340 bool CanInsertDtmf() override;
341 bool InsertDtmf(int code, int duration) override;
deadbeef20cb0c12017-02-02 04:27:00342
343 // ObserverInterface implementation.
ossu7bb87ee2017-01-23 12:56:25344 void OnChanged() override;
345
ossu7bb87ee2017-01-23 12:56:25346 cricket::MediaType media_type() const override {
347 return cricket::MEDIA_TYPE_AUDIO;
348 }
Amit Hilbuchea7ef2a2019-02-19 23:20:21349 std::string track_kind() const override {
350 return MediaStreamTrackInterface::kAudioKind;
351 }
ossu7bb87ee2017-01-23 12:56:25352
deadbeef20cb0c12017-02-02 04:27:00353 rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const override;
Philipp Hanckea1b4eb22022-11-04 13:45:23354 RTCError GenerateKeyFrame(const std::vector<std::string>& rids) override;
deadbeef20cb0c12017-02-02 04:27:00355
Amit Hilbuchea7ef2a2019-02-19 23:20:21356 protected:
357 AudioRtpSender(rtc::Thread* worker_thread,
358 const std::string& id,
Henrik Boströmf7859892022-07-04 12:36:37359 LegacyStatsCollectorInterface* legacy_stats,
Guido Urdaneta1ff16c82019-05-20 17:31:53360 SetStreamsObserver* set_streams_observer);
Benjamin Wrightd81ac952018-08-30 00:02:10361
Amit Hilbuchea7ef2a2019-02-19 23:20:21362 void SetSend() override;
363 void ClearSend() override;
Benjamin Wrightd81ac952018-08-30 00:02:10364
Amit Hilbuchea7ef2a2019-02-19 23:20:21365 // Hooks to allow custom logic when tracks are attached and detached.
366 void AttachTrack() override;
367 void DetachTrack() override;
368 void AddTrackToStats() override;
369 void RemoveTrackFromStats() override;
Amit Hilbuch2297d332019-02-19 20:49:22370
ossu7bb87ee2017-01-23 12:56:25371 private:
Amit Hilbuchea7ef2a2019-02-19 23:20:21372 cricket::VoiceMediaChannel* voice_media_channel() {
373 return static_cast<cricket::VoiceMediaChannel*>(media_channel_);
374 }
375 rtc::scoped_refptr<AudioTrackInterface> audio_track() const {
376 return rtc::scoped_refptr<AudioTrackInterface>(
377 static_cast<AudioTrackInterface*>(track_.get()));
378 }
deadbeef20cb0c12017-02-02 04:27:00379
Henrik Boströmf7859892022-07-04 12:36:37380 LegacyStatsCollectorInterface* legacy_stats_ = nullptr;
Fredrik Solenbergda2afbd2022-08-03 10:07:51381 rtc::scoped_refptr<DtmfSender> dtmf_sender_;
deadbeef20cb0c12017-02-02 04:27:00382 rtc::scoped_refptr<DtmfSenderInterface> dtmf_sender_proxy_;
ossu7bb87ee2017-01-23 12:56:25383 bool cached_track_enabled_ = false;
ossu7bb87ee2017-01-23 12:56:25384
Artem Titov880fa812021-07-30 20:30:23385 // Used to pass the data callback from the `track_` to the other end of
ossu7bb87ee2017-01-23 12:56:25386 // cricket::AudioSource.
387 std::unique_ptr<LocalAudioSinkAdapter> sink_adapter_;
388};
389
Amit Hilbuchea7ef2a2019-02-19 23:20:21390class VideoRtpSender : public RtpSenderBase {
ossu7bb87ee2017-01-23 12:56:25391 public:
Steve Anton111fdfd2018-06-25 20:03:36392 // Construct an RtpSender for video with the given sender ID.
393 // The sender is initialized with no track to send and no associated streams.
Artem Titov880fa812021-07-30 20:30:23394 // If `set_streams_observer` is not null, it is invoked when SetStreams()
395 // is called. `set_streams_observer` is not owned by this object. If not
Guido Urdaneta1ff16c82019-05-20 17:31:53396 // null, it must be valid at least until this sender becomes stopped.
397 static rtc::scoped_refptr<VideoRtpSender> Create(
398 rtc::Thread* worker_thread,
399 const std::string& id,
400 SetStreamsObserver* set_streams_observer);
ossu7bb87ee2017-01-23 12:56:25401 virtual ~VideoRtpSender();
402
403 // ObserverInterface implementation
404 void OnChanged() override;
405
ossu7bb87ee2017-01-23 12:56:25406 cricket::MediaType media_type() const override {
407 return cricket::MEDIA_TYPE_VIDEO;
408 }
Amit Hilbuchea7ef2a2019-02-19 23:20:21409 std::string track_kind() const override {
410 return MediaStreamTrackInterface::kVideoKind;
Florent Castelli892acf02018-10-01 20:47:20411 }
ossu7bb87ee2017-01-23 12:56:25412
deadbeef20cb0c12017-02-02 04:27:00413 rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const override;
Philipp Hanckea1b4eb22022-11-04 13:45:23414 RTCError GenerateKeyFrame(const std::vector<std::string>& rids) override;
deadbeef20cb0c12017-02-02 04:27:00415
Florent Castelli725ee242022-10-18 15:05:58416 RTCError CheckSVCParameters(const RtpParameters& parameters) override;
417
Amit Hilbuchea7ef2a2019-02-19 23:20:21418 protected:
Guido Urdaneta1ff16c82019-05-20 17:31:53419 VideoRtpSender(rtc::Thread* worker_thread,
420 const std::string& id,
421 SetStreamsObserver* set_streams_observer);
Benjamin Wrightd81ac952018-08-30 00:02:10422
Amit Hilbuchea7ef2a2019-02-19 23:20:21423 void SetSend() override;
424 void ClearSend() override;
Benjamin Wrightd81ac952018-08-30 00:02:10425
Amit Hilbuchea7ef2a2019-02-19 23:20:21426 // Hook to allow custom logic when tracks are attached.
427 void AttachTrack() override;
Amit Hilbuch2297d332019-02-19 20:49:22428
ossu7bb87ee2017-01-23 12:56:25429 private:
Amit Hilbuchea7ef2a2019-02-19 23:20:21430 cricket::VideoMediaChannel* video_media_channel() {
431 return static_cast<cricket::VideoMediaChannel*>(media_channel_);
432 }
433 rtc::scoped_refptr<VideoTrackInterface> video_track() const {
434 return rtc::scoped_refptr<VideoTrackInterface>(
435 static_cast<VideoTrackInterface*>(track_.get()));
436 }
ossu7bb87ee2017-01-23 12:56:25437
ossu7bb87ee2017-01-23 12:56:25438 VideoTrackInterface::ContentHint cached_track_content_hint_ =
439 VideoTrackInterface::ContentHint::kNone;
ossu7bb87ee2017-01-23 12:56:25440};
441
442} // namespace webrtc
443
Steve Anton10542f22019-01-11 17:11:00444#endif // PC_RTP_SENDER_H_