OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // This file contains interfaces for RtpSenders | 11 // This file contains interfaces for RtpSenders |
12 // http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface | 12 // http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface |
13 | 13 |
14 #ifndef WEBRTC_API_RTPSENDERINTERFACE_H_ | 14 #ifndef WEBRTC_API_RTPSENDERINTERFACE_H_ |
15 #define WEBRTC_API_RTPSENDERINTERFACE_H_ | 15 #define WEBRTC_API_RTPSENDERINTERFACE_H_ |
16 | 16 |
17 #include <string> | 17 #include <string> |
| 18 #include <vector> |
18 | 19 |
19 #include "webrtc/api/mediastreaminterface.h" | 20 #include "webrtc/api/mediastreaminterface.h" |
20 #include "webrtc/api/proxy.h" | 21 #include "webrtc/api/proxy.h" |
21 #include "webrtc/api/rtpparameters.h" | 22 #include "webrtc/api/rtpparameters.h" |
22 #include "webrtc/base/refcount.h" | 23 #include "webrtc/base/refcount.h" |
23 #include "webrtc/base/scoped_ref_ptr.h" | 24 #include "webrtc/base/scoped_ref_ptr.h" |
24 #include "webrtc/pc/mediasession.h" | 25 #include "webrtc/pc/mediasession.h" |
25 | 26 |
26 namespace webrtc { | 27 namespace webrtc { |
27 | 28 |
28 class RtpSenderInterface : public rtc::RefCountInterface { | 29 class RtpSenderInterface : public rtc::RefCountInterface { |
29 public: | 30 public: |
30 // Returns true if successful in setting the track. | 31 // Returns true if successful in setting the track. |
31 // Fails if an audio track is set on a video RtpSender, or vice-versa. | 32 // Fails if an audio track is set on a video RtpSender, or vice-versa. |
32 virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; | 33 virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; |
33 virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; | 34 virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
34 | 35 |
35 // Used to set the SSRC of the sender, once a local description has been set. | 36 // Returns primary SSRC used by this sender for sending media. |
36 // If |ssrc| is 0, this indiates that the sender should disconnect from the | 37 // Returns 0 if not yet determined. |
37 // underlying transport (this occurs if the sender isn't seen in a local | 38 // TODO(deadbeef): Change to rtc::Optional. |
38 // description). | 39 // TODO(deadbeef): Remove? With GetParameters this should be redundant. |
39 virtual void SetSsrc(uint32_t ssrc) = 0; | |
40 virtual uint32_t ssrc() const = 0; | 40 virtual uint32_t ssrc() const = 0; |
41 | 41 |
42 // Audio or video sender? | 42 // Audio or video sender? |
43 virtual cricket::MediaType media_type() const = 0; | 43 virtual cricket::MediaType media_type() const = 0; |
44 | 44 |
45 // Not to be confused with "mid", this is a field we can temporarily use | 45 // 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. | 46 // to uniquely identify a receiver until we implement Unified Plan SDP. |
47 virtual std::string id() const = 0; | 47 virtual std::string id() const = 0; |
48 | 48 |
49 // TODO(deadbeef): Support one sender having multiple stream ids. | 49 virtual std::vector<std::string> stream_ids() const = 0; |
50 virtual void set_stream_id(const std::string& stream_id) = 0; | |
51 virtual std::string stream_id() const = 0; | |
52 | |
53 virtual void Stop() = 0; | |
54 | 50 |
55 virtual RtpParameters GetParameters() const = 0; | 51 virtual RtpParameters GetParameters() const = 0; |
56 virtual bool SetParameters(const RtpParameters& parameters) = 0; | 52 virtual bool SetParameters(const RtpParameters& parameters) = 0; |
57 | 53 |
58 protected: | 54 protected: |
59 virtual ~RtpSenderInterface() {} | 55 virtual ~RtpSenderInterface() {} |
60 }; | 56 }; |
61 | 57 |
62 // Define proxy for RtpSenderInterface. | 58 // Define proxy for RtpSenderInterface. |
63 BEGIN_SIGNALING_PROXY_MAP(RtpSender) | 59 BEGIN_SIGNALING_PROXY_MAP(RtpSender) |
64 PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) | 60 PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) |
65 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) | 61 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
66 PROXY_METHOD1(void, SetSsrc, uint32_t) | |
67 PROXY_CONSTMETHOD0(uint32_t, ssrc) | 62 PROXY_CONSTMETHOD0(uint32_t, ssrc) |
68 PROXY_CONSTMETHOD0(cricket::MediaType, media_type) | 63 PROXY_CONSTMETHOD0(cricket::MediaType, media_type) |
69 PROXY_CONSTMETHOD0(std::string, id) | 64 PROXY_CONSTMETHOD0(std::string, id) |
70 PROXY_METHOD1(void, set_stream_id, const std::string&) | 65 PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids) |
71 PROXY_CONSTMETHOD0(std::string, stream_id) | |
72 PROXY_METHOD0(void, Stop) | |
73 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); | 66 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
74 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) | 67 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
75 END_SIGNALING_PROXY() | 68 END_SIGNALING_PROXY() |
76 | 69 |
77 } // namespace webrtc | 70 } // namespace webrtc |
78 | 71 |
79 #endif // WEBRTC_API_RTPSENDERINTERFACE_H_ | 72 #endif // WEBRTC_API_RTPSENDERINTERFACE_H_ |
OLD | NEW |