OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * libjingle | |
3 * Copyright 2015 Google Inc. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions are met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright notice, | |
9 * this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 * this list of conditions and the following disclaimer in the documentation | |
12 * and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
28 // This file contains classes that implement RtpReceiverInterface. | |
29 // An RtpReceiver associates a MediaStreamTrackInterface with an underlying | |
30 // transport (provided by AudioProviderInterface/VideoProviderInterface) | |
31 | |
32 #ifndef TALK_APP_WEBRTC_RTPRECEIVER_H_ | |
33 #define TALK_APP_WEBRTC_RTPRECEIVER_H_ | |
34 | |
35 #include <string> | |
36 | |
37 #include "talk/app/webrtc/mediastreamprovider.h" | |
38 #include "talk/app/webrtc/rtpreceiverinterface.h" | |
39 #include "webrtc/base/basictypes.h" | |
40 | |
41 namespace webrtc { | |
42 | |
43 class BaseRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { | |
44 public: | |
45 virtual void DetachFromProvider() = 0; | |
pthatcher1
2015/09/23 14:47:40
I think it would make sense to call this method St
pthatcher1
2015/09/24 06:32:29
I still think we should call this method Stop.
| |
46 | |
47 protected: | |
48 virtual ~BaseRtpReceiver() {} | |
49 }; | |
50 | |
51 class AudioRtpReceiver : public ObserverInterface, | |
52 public AudioSourceInterface::AudioObserver, | |
53 public BaseRtpReceiver { | |
54 public: | |
55 AudioRtpReceiver(AudioTrackInterface* track, | |
56 uint32 ssrc, | |
57 AudioProviderInterface* provider); | |
58 | |
59 virtual ~AudioRtpReceiver(); | |
60 | |
61 // ObserverInterface implementation | |
62 void OnChanged() override; | |
63 | |
64 // AudioSourceInterface::AudioObserver implementation | |
65 void OnSetVolume(double volume) override; | |
66 | |
67 // RtpReceiverInterface implementation | |
68 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { | |
69 return track_.get(); | |
70 } | |
71 | |
72 void DetachFromProvider() override; | |
73 | |
74 private: | |
75 void UpdateProvider(); | |
76 | |
77 rtc::scoped_refptr<AudioTrackInterface> track_; | |
78 uint32 ssrc_; | |
79 AudioProviderInterface* provider_; | |
80 bool cached_track_enabled_; | |
pthatcher1
2015/09/23 14:47:40
Why not just track_enabled_, with a comment explai
| |
81 }; | |
82 | |
83 class VideoRtpReceiver : public BaseRtpReceiver { | |
84 public: | |
85 VideoRtpReceiver(VideoTrackInterface* track, | |
86 uint32 ssrc, | |
87 VideoProviderInterface* provider); | |
88 | |
89 virtual ~VideoRtpReceiver(); | |
90 | |
91 // RtpReceiverInterface implementation | |
92 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { | |
93 return track_.get(); | |
94 } | |
95 | |
96 void DetachFromProvider() override; | |
97 | |
98 private: | |
99 rtc::scoped_refptr<VideoTrackInterface> track_; | |
100 uint32 ssrc_; | |
101 VideoProviderInterface* provider_; | |
102 }; | |
103 | |
104 } // namespace webrtc | |
105 | |
106 #endif // TALK_APP_WEBRTC_RTPRECEIVER_H_ | |
OLD | NEW |