OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
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. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_API_MEDIASTREAMPROVIDER_H_ | |
12 #define WEBRTC_API_MEDIASTREAMPROVIDER_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "webrtc/api/rtpsenderinterface.h" | |
17 #include "webrtc/base/basictypes.h" | |
18 #include "webrtc/media/base/videosinkinterface.h" | |
19 #include "webrtc/media/base/videosourceinterface.h" | |
20 | |
21 namespace cricket { | |
22 | |
23 class AudioSource; | |
24 class VideoFrame; | |
25 struct AudioOptions; | |
26 struct VideoOptions; | |
27 | |
28 } // namespace cricket | |
29 | |
30 namespace webrtc { | |
31 | |
32 class AudioSinkInterface; | |
33 | |
34 // TODO(deadbeef): Change the key from an ssrc to a "sender_id" or | |
35 // "receiver_id" string, which will be the MSID in the short term and MID in | |
36 // the long term. | |
37 | |
38 // TODO(deadbeef): These interfaces are effectively just a way for the | |
39 // RtpSenders/Receivers to get to the BaseChannels. These interfaces should be | |
40 // refactored away eventually, as the classes converge. | |
41 | |
42 // This interface is called by AudioRtpSender/Receivers to change the settings | |
43 // of an audio track connected to certain PeerConnection. | |
44 class AudioProviderInterface { | |
45 public: | |
46 // Enable/disable the audio playout of a remote audio track with |ssrc|. | |
47 virtual void SetAudioPlayout(uint32_t ssrc, bool enable) = 0; | |
48 // Enable/disable sending audio on the local audio track with |ssrc|. | |
49 // When |enable| is true |options| should be applied to the audio track. | |
50 virtual void SetAudioSend(uint32_t ssrc, | |
51 bool enable, | |
52 const cricket::AudioOptions& options, | |
53 cricket::AudioSource* source) = 0; | |
54 | |
55 // Sets the audio playout volume of a remote audio track with |ssrc|. | |
56 // |volume| is in the range of [0, 10]. | |
57 virtual void SetAudioPlayoutVolume(uint32_t ssrc, double volume) = 0; | |
58 | |
59 // Allows for setting a direct audio sink for an incoming audio source. | |
60 // Only one audio sink is supported per ssrc and ownership of the sink is | |
61 // passed to the provider. | |
62 virtual void SetRawAudioSink( | |
63 uint32_t ssrc, | |
64 std::unique_ptr<webrtc::AudioSinkInterface> sink) = 0; | |
65 | |
66 virtual RtpParameters GetAudioRtpSendParameters(uint32_t ssrc) const = 0; | |
67 virtual bool SetAudioRtpSendParameters(uint32_t ssrc, | |
68 const RtpParameters& parameters) = 0; | |
69 | |
70 virtual RtpParameters GetAudioRtpReceiveParameters(uint32_t ssrc) const = 0; | |
71 virtual bool SetAudioRtpReceiveParameters( | |
72 uint32_t ssrc, | |
73 const RtpParameters& parameters) = 0; | |
74 | |
75 protected: | |
76 virtual ~AudioProviderInterface() {} | |
77 }; | |
78 | |
79 // This interface is called by VideoRtpSender/Receivers to change the settings | |
80 // of a video track connected to a certain PeerConnection. | |
81 class VideoProviderInterface { | |
82 public: | |
83 // Enable/disable the video playout of a remote video track with |ssrc|. | |
84 virtual void SetVideoPlayout( | |
85 uint32_t ssrc, | |
86 bool enable, | |
87 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) = 0; | |
88 // Enable/disable sending video on the local video track with |ssrc|. | |
89 // TODO(deadbeef): Make |options| a reference parameter. | |
90 // TODO(deadbeef): Eventually, |enable| and |options| will be contained | |
91 // in |source|. When that happens, remove those parameters and rename | |
92 // this to SetVideoSource. | |
93 virtual void SetVideoSend( | |
94 uint32_t ssrc, | |
95 bool enable, | |
96 const cricket::VideoOptions* options, | |
97 rtc::VideoSourceInterface<cricket::VideoFrame>* source) = 0; | |
98 | |
99 virtual RtpParameters GetVideoRtpSendParameters(uint32_t ssrc) const = 0; | |
100 virtual bool SetVideoRtpSendParameters(uint32_t ssrc, | |
101 const RtpParameters& parameters) = 0; | |
102 | |
103 virtual RtpParameters GetVideoRtpReceiveParameters(uint32_t ssrc) const = 0; | |
104 virtual bool SetVideoRtpReceiveParameters( | |
105 uint32_t ssrc, | |
106 const RtpParameters& parameters) = 0; | |
107 | |
108 protected: | |
109 virtual ~VideoProviderInterface() {} | |
110 }; | |
111 | |
112 } // namespace webrtc | |
113 | |
114 #endif // WEBRTC_API_MEDIASTREAMPROVIDER_H_ | |
OLD | NEW |