blob: a7fbbda46b9716d36380f0fb9daaec403fae1aa9 [file] [log] [blame]
deadbeef6979b022015-09-24 16:47:53 -07001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
deadbeef6979b022015-09-24 16:47:53 -07003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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.
deadbeef6979b022015-09-24 16:47:53 -07009 */
10
deadbeef70ab1a12015-09-28 16:53:55 -070011// This file contains interfaces for RtpSenders
12// http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface
13
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#ifndef API_RTPSENDERINTERFACE_H_
15#define API_RTPSENDERINTERFACE_H_
deadbeef70ab1a12015-09-28 16:53:55 -070016
17#include <string>
deadbeefa601f5c2016-06-06 14:27:39 -070018#include <vector>
deadbeef70ab1a12015-09-28 16:53:55 -070019
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "api/dtmfsenderinterface.h"
21#include "api/mediastreaminterface.h"
22#include "api/mediatypes.h"
23#include "api/proxy.h"
24#include "api/rtpparameters.h"
25#include "rtc_base/refcount.h"
26#include "rtc_base/scoped_ref_ptr.h"
deadbeef70ab1a12015-09-28 16:53:55 -070027
28namespace webrtc {
29
30class RtpSenderInterface : public rtc::RefCountInterface {
31 public:
32 // Returns true if successful in setting the track.
33 // Fails if an audio track is set on a video RtpSender, or vice-versa.
34 virtual bool SetTrack(MediaStreamTrackInterface* track) = 0;
35 virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0;
36
deadbeefa601f5c2016-06-06 14:27:39 -070037 // Returns primary SSRC used by this sender for sending media.
38 // Returns 0 if not yet determined.
39 // TODO(deadbeef): Change to rtc::Optional.
40 // TODO(deadbeef): Remove? With GetParameters this should be redundant.
deadbeeffac06552015-11-25 11:26:01 -080041 virtual uint32_t ssrc() const = 0;
42
43 // Audio or video sender?
44 virtual cricket::MediaType media_type() const = 0;
45
deadbeef70ab1a12015-09-28 16:53:55 -070046 // Not to be confused with "mid", this is a field we can temporarily use
47 // to uniquely identify a receiver until we implement Unified Plan SDP.
48 virtual std::string id() const = 0;
49
deadbeefb10f32f2017-02-08 01:38:21 -080050 // Returns a list of streams associated with this sender's track. Although we
51 // only support one track per stream, in theory the API allows for multiple.
deadbeefa601f5c2016-06-06 14:27:39 -070052 virtual std::vector<std::string> stream_ids() const = 0;
deadbeef70ab1a12015-09-28 16:53:55 -070053
skvladdc1c62c2016-03-16 19:07:43 -070054 virtual RtpParameters GetParameters() const = 0;
deadbeefb10f32f2017-02-08 01:38:21 -080055 // Note that only a subset of the parameters can currently be changed. See
56 // rtpparameters.h
skvladdc1c62c2016-03-16 19:07:43 -070057 virtual bool SetParameters(const RtpParameters& parameters) = 0;
58
deadbeef20cb0c12017-02-01 20:27:00 -080059 // Returns null for a video sender.
60 virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0;
61
deadbeef70ab1a12015-09-28 16:53:55 -070062 protected:
63 virtual ~RtpSenderInterface() {}
64};
65
66// Define proxy for RtpSenderInterface.
deadbeefb10f32f2017-02-08 01:38:21 -080067// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
68// are called on is an implementation detail.
nisse72c8d2b2016-04-15 03:49:07 -070069BEGIN_SIGNALING_PROXY_MAP(RtpSender)
deadbeefd99a2002017-01-18 08:55:23 -080070 PROXY_SIGNALING_THREAD_DESTRUCTOR()
71 PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
72 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
73 PROXY_CONSTMETHOD0(uint32_t, ssrc)
74 PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
75 PROXY_CONSTMETHOD0(std::string, id)
76 PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
77 PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
78 PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
deadbeef20cb0c12017-02-01 20:27:00 -080079 PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender);
deadbeefd99a2002017-01-18 08:55:23 -080080END_PROXY_MAP()
deadbeef70ab1a12015-09-28 16:53:55 -070081
82} // namespace webrtc
83
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020084#endif // API_RTPSENDERINTERFACE_H_