blob: c940dc7c092beca8971aa9a5d2203dd8b1641215 [file] [log] [blame]
deadbeef6979b022015-09-24 23:47:531/*
kjellanderb24317b2016-02-10 15:54:432 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
deadbeef6979b022015-09-24 23:47:533 *
kjellanderb24317b2016-02-10 15:54:434 * 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 23:47:539 */
10
deadbeef70ab1a12015-09-28 23:53:5511// This file contains interfaces for RtpSenders
12// http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface
13
Henrik Kjellander15583c12016-02-10 09:53:1214#ifndef WEBRTC_API_RTPSENDERINTERFACE_H_
15#define WEBRTC_API_RTPSENDERINTERFACE_H_
deadbeef70ab1a12015-09-28 23:53:5516
17#include <string>
deadbeefa601f5c2016-06-06 21:27:3918#include <vector>
deadbeef70ab1a12015-09-28 23:53:5519
Henrik Kjellander15583c12016-02-10 09:53:1220#include "webrtc/api/mediastreaminterface.h"
21#include "webrtc/api/proxy.h"
skvladdc1c62c2016-03-17 02:07:4322#include "webrtc/api/rtpparameters.h"
deadbeef70ab1a12015-09-28 23:53:5523#include "webrtc/base/refcount.h"
24#include "webrtc/base/scoped_ref_ptr.h"
kjellander@webrtc.org9b8df252016-02-12 05:47:5925#include "webrtc/pc/mediasession.h"
deadbeef70ab1a12015-09-28 23:53:5526
27namespace webrtc {
28
29class RtpSenderInterface : public rtc::RefCountInterface {
30 public:
31 // Returns true if successful in setting the track.
32 // Fails if an audio track is set on a video RtpSender, or vice-versa.
33 virtual bool SetTrack(MediaStreamTrackInterface* track) = 0;
34 virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0;
35
deadbeefa601f5c2016-06-06 21:27:3936 // Returns primary SSRC used by this sender for sending media.
37 // Returns 0 if not yet determined.
38 // TODO(deadbeef): Change to rtc::Optional.
39 // TODO(deadbeef): Remove? With GetParameters this should be redundant.
deadbeeffac06552015-11-25 19:26:0140 virtual uint32_t ssrc() const = 0;
41
42 // Audio or video sender?
43 virtual cricket::MediaType media_type() const = 0;
44
deadbeef70ab1a12015-09-28 23:53:5545 // 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
deadbeefa601f5c2016-06-06 21:27:3949 virtual std::vector<std::string> stream_ids() const = 0;
deadbeef70ab1a12015-09-28 23:53:5550
skvladdc1c62c2016-03-17 02:07:4351 virtual RtpParameters GetParameters() const = 0;
52 virtual bool SetParameters(const RtpParameters& parameters) = 0;
53
deadbeef70ab1a12015-09-28 23:53:5554 protected:
55 virtual ~RtpSenderInterface() {}
56};
57
58// Define proxy for RtpSenderInterface.
nisse72c8d2b2016-04-15 10:49:0759BEGIN_SIGNALING_PROXY_MAP(RtpSender)
deadbeef70ab1a12015-09-28 23:53:5560PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
61PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
deadbeeffac06552015-11-25 19:26:0162PROXY_CONSTMETHOD0(uint32_t, ssrc)
63PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
deadbeef70ab1a12015-09-28 23:53:5564PROXY_CONSTMETHOD0(std::string, id)
deadbeefa601f5c2016-06-06 21:27:3965PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
skvladdc1c62c2016-03-17 02:07:4366PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
67PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
nisse72c8d2b2016-04-15 10:49:0768END_SIGNALING_PROXY()
deadbeef70ab1a12015-09-28 23:53:5569
70} // namespace webrtc
71
Henrik Kjellander15583c12016-02-10 09:53:1272#endif // WEBRTC_API_RTPSENDERINTERFACE_H_