1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_RECEIVER_PLATFORM_H_
6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_RECEIVER_PLATFORM_H_
7 
8 #include <memory>
9 
10 #include "base/optional.h"
11 #include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
12 #include "third_party/blink/renderer/platform/platform_export.h"
13 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
14 #include "third_party/blink/renderer/platform/wtf/vector.h"
15 #include "third_party/webrtc/api/dtls_transport_interface.h"
16 #include "third_party/webrtc/api/rtp_parameters.h"
17 #include "third_party/webrtc/api/stats/rtc_stats.h"
18 
19 namespace blink {
20 
21 class RTCEncodedAudioStreamTransformer;
22 class RTCEncodedVideoStreamTransformer;
23 class RTCRtpSource;
24 class WebMediaStreamTrack;
25 
26 // Implementations of this interface keep the corresponding WebRTC-layer
27 // receiver alive through reference counting. Multiple |RTCRtpReceiverPlatform|s
28 // could reference the same receiver, see |id|.
29 // https://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface
30 class PLATFORM_EXPORT RTCRtpReceiverPlatform {
31  public:
32   virtual ~RTCRtpReceiverPlatform();
33 
34   virtual std::unique_ptr<RTCRtpReceiverPlatform> ShallowCopy() const = 0;
35   // Two |RTCRtpReceiverPlatform|s referencing the same WebRTC-layer receiver
36   // have the same |id|.
37   virtual uintptr_t Id() const = 0;
38   virtual rtc::scoped_refptr<webrtc::DtlsTransportInterface>
39   DtlsTransport() = 0;
40   // Note: For convenience, DtlsTransportInformation always returns a value.
41   // The information is only interesting if DtlsTransport() is non-null.
42   virtual webrtc::DtlsTransportInformation DtlsTransportInformation() = 0;
43   virtual const WebMediaStreamTrack& Track() const = 0;
44   virtual Vector<String> StreamIds() const = 0;
45   virtual Vector<std::unique_ptr<RTCRtpSource>> GetSources() = 0;
46   virtual void GetStats(RTCStatsReportCallback,
47                         const Vector<webrtc::NonStandardGroupId>&) = 0;
48   virtual std::unique_ptr<webrtc::RtpParameters> GetParameters() const = 0;
49   virtual void SetJitterBufferMinimumDelay(
50       base::Optional<double> delay_seconds) = 0;
GetEncodedAudioStreamTransformer()51   virtual RTCEncodedAudioStreamTransformer* GetEncodedAudioStreamTransformer()
52       const {
53     return nullptr;
54   }
GetEncodedVideoStreamTransformer()55   virtual RTCEncodedVideoStreamTransformer* GetEncodedVideoStreamTransformer()
56       const {
57     return nullptr;
58   }
59 };
60 
61 }  // namespace blink
62 
63 #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_RECEIVER_PLATFORM_H_
64