OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 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_ORTC_RTPSENDERSHIM_H_ |
| 12 #define WEBRTC_ORTC_RTPSENDERSHIM_H_ |
| 13 |
| 14 #include <memory> |
| 15 |
| 16 #include "webrtc/api/ortc/ortcrtpsenderinterface.h" |
| 17 #include "webrtc/api/rtcerror.h" |
| 18 #include "webrtc/api/rtpparameters.h" |
| 19 #include "webrtc/base/constructormagic.h" |
| 20 #include "webrtc/ortc/rtptransportcontrollershim.h" |
| 21 #include "webrtc/ortc/rtptransportshim.h" |
| 22 #include "webrtc/pc/rtpsender.h" |
| 23 |
| 24 namespace webrtc { |
| 25 |
| 26 // Implementation of OrtcRtpSenderInterface that works with RtpTransportShim, |
| 27 // and wraps a VideoRtpSender/AudioRtpSender that's normally used with the |
| 28 // PeerConnection. |
| 29 // |
| 30 // TODO(deadbeef): When BaseChannel is split apart into separate |
| 31 // "RtpSender"/"RtpTransceiver"/"RtpSender"/"RtpReceiver" objects, this shim |
| 32 // object can be removed. |
| 33 class RtpSenderShim : public OrtcRtpSenderInterface { |
| 34 public: |
| 35 // Doesn't take ownership of |transport| or |rtp_transport_controller|. |
| 36 static RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateProxied( |
| 37 cricket::MediaType kind, |
| 38 const RtpParameters& parameters, |
| 39 RtpTransportShim* transport); |
| 40 ~RtpSenderShim() override; |
| 41 |
| 42 // OrtcRtpSenderInterface implementation. |
| 43 RTCError SetTrack(MediaStreamTrackInterface* track) override; |
| 44 rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const override; |
| 45 |
| 46 RTCError SetTransport(RtpTransportInterface* transport) override; |
| 47 RtpTransportInterface* GetTransport() const override; |
| 48 |
| 49 RTCError SetParameters(const RtpParameters& parameters) override; |
| 50 RtpParameters GetParameters() const override; |
| 51 |
| 52 cricket::MediaType GetKind() const override; |
| 53 |
| 54 private: |
| 55 // Methods called internally be Create factory method. |
| 56 RtpSenderShim(cricket::MediaType kind, |
| 57 RtpTransportShim* transport, |
| 58 RtpTransportControllerShim* rtp_transport_controller); |
| 59 void CreateInternalSender(); |
| 60 |
| 61 cricket::MediaType kind_; |
| 62 RtpTransportShim* transport_; |
| 63 RtpTransportControllerShim* rtp_transport_controller_; |
| 64 // Scoped refptr due to ref-counted interface, but we should be the only |
| 65 // reference holder. |
| 66 rtc::scoped_refptr<RtpSenderInternal> internal_sender_; |
| 67 RtpParameters last_applied_parameters_; |
| 68 |
| 69 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpSenderShim); |
| 70 }; |
| 71 |
| 72 } // namespace webrtc |
| 73 |
| 74 #endif // WEBRTC_ORTC_RTPSENDERSHIM_H_ |
OLD | NEW |