blob: 68547b09cf1ddad726ce9d96f7ae8b7f38618b20 [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
Henrik Kjellander15583c12016-02-10 10:53:12 +010014#ifndef WEBRTC_API_RTPSENDERINTERFACE_H_
15#define WEBRTC_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
deadbeef20cb0c12017-02-01 20:27:00 -080020#include "webrtc/api/dtmfsenderinterface.h"
ossu7bb87ee2017-01-23 04:56:25 -080021#include "webrtc/api/mediatypes.h"
Henrik Kjellander15583c12016-02-10 10:53:12 +010022#include "webrtc/api/mediastreaminterface.h"
23#include "webrtc/api/proxy.h"
skvladdc1c62c2016-03-16 19:07:43 -070024#include "webrtc/api/rtpparameters.h"
deadbeef70ab1a12015-09-28 16:53:55 -070025#include "webrtc/base/refcount.h"
26#include "webrtc/base/scoped_ref_ptr.h"
27
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
deadbeefa601f5c2016-06-06 14:27:39 -070050 virtual std::vector<std::string> stream_ids() const = 0;
deadbeef70ab1a12015-09-28 16:53:55 -070051
skvladdc1c62c2016-03-16 19:07:43 -070052 virtual RtpParameters GetParameters() const = 0;
53 virtual bool SetParameters(const RtpParameters& parameters) = 0;
54
deadbeef20cb0c12017-02-01 20:27:00 -080055 // Returns null for a video sender.
56 virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0;
57
deadbeef70ab1a12015-09-28 16:53:55 -070058 protected:
59 virtual ~RtpSenderInterface() {}
60};
61
62// Define proxy for RtpSenderInterface.
nisse72c8d2b2016-04-15 03:49:07 -070063BEGIN_SIGNALING_PROXY_MAP(RtpSender)
deadbeefd99a2002017-01-18 08:55:23 -080064 PROXY_SIGNALING_THREAD_DESTRUCTOR()
65 PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
66 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
67 PROXY_CONSTMETHOD0(uint32_t, ssrc)
68 PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
69 PROXY_CONSTMETHOD0(std::string, id)
70 PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
71 PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
72 PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
deadbeef20cb0c12017-02-01 20:27:00 -080073 PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender);
deadbeefd99a2002017-01-18 08:55:23 -080074END_PROXY_MAP()
deadbeef70ab1a12015-09-28 16:53:55 -070075
76} // namespace webrtc
77
Henrik Kjellander15583c12016-02-10 10:53:12 +010078#endif // WEBRTC_API_RTPSENDERINTERFACE_H_