blob: 2291bb4e214d8c9aa48adcaf5f2173b896c1e583 [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>
18
Henrik Kjellander15583c12016-02-10 10:53:12 +010019#include "webrtc/api/mediastreaminterface.h"
20#include "webrtc/api/proxy.h"
skvladdc1c62c2016-03-16 19:07:43 -070021#include "webrtc/api/rtpparameters.h"
deadbeef70ab1a12015-09-28 16:53:55 -070022#include "webrtc/base/refcount.h"
23#include "webrtc/base/scoped_ref_ptr.h"
kjellander@webrtc.org9b8df252016-02-12 06:47:59 +010024#include "webrtc/pc/mediasession.h"
deadbeef70ab1a12015-09-28 16:53:55 -070025
26namespace webrtc {
27
28class RtpSenderInterface : public rtc::RefCountInterface {
29 public:
30 // Returns true if successful in setting the track.
31 // Fails if an audio track is set on a video RtpSender, or vice-versa.
32 virtual bool SetTrack(MediaStreamTrackInterface* track) = 0;
33 virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0;
34
deadbeeffac06552015-11-25 11:26:01 -080035 // Used to set the SSRC of the sender, once a local description has been set.
36 // If |ssrc| is 0, this indiates that the sender should disconnect from the
37 // underlying transport (this occurs if the sender isn't seen in a local
38 // description).
39 virtual void SetSsrc(uint32_t ssrc) = 0;
40 virtual uint32_t ssrc() const = 0;
41
42 // Audio or video sender?
43 virtual cricket::MediaType media_type() const = 0;
44
deadbeef70ab1a12015-09-28 16:53:55 -070045 // Not to be confused with "mid", this is a field we can temporarily use
46 // to uniquely identify a receiver until we implement Unified Plan SDP.
47 virtual std::string id() const = 0;
48
deadbeeffac06552015-11-25 11:26:01 -080049 // TODO(deadbeef): Support one sender having multiple stream ids.
50 virtual void set_stream_id(const std::string& stream_id) = 0;
51 virtual std::string stream_id() const = 0;
52
deadbeef70ab1a12015-09-28 16:53:55 -070053 virtual void Stop() = 0;
54
skvladdc1c62c2016-03-16 19:07:43 -070055 virtual RtpParameters GetParameters() const = 0;
56 virtual bool SetParameters(const RtpParameters& parameters) = 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)
deadbeef70ab1a12015-09-28 16:53:55 -070064PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
65PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
deadbeeffac06552015-11-25 11:26:01 -080066PROXY_METHOD1(void, SetSsrc, uint32_t)
67PROXY_CONSTMETHOD0(uint32_t, ssrc)
68PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
deadbeef70ab1a12015-09-28 16:53:55 -070069PROXY_CONSTMETHOD0(std::string, id)
deadbeeffac06552015-11-25 11:26:01 -080070PROXY_METHOD1(void, set_stream_id, const std::string&)
71PROXY_CONSTMETHOD0(std::string, stream_id)
deadbeef70ab1a12015-09-28 16:53:55 -070072PROXY_METHOD0(void, Stop)
skvladdc1c62c2016-03-16 19:07:43 -070073PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
74PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
nisse72c8d2b2016-04-15 03:49:07 -070075END_SIGNALING_PROXY()
deadbeef70ab1a12015-09-28 16:53:55 -070076
77} // namespace webrtc
78
Henrik Kjellander15583c12016-02-10 10:53:12 +010079#endif // WEBRTC_API_RTPSENDERINTERFACE_H_