1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #ifndef CALL_RECEIVE_STREAM_H_ 12*d9f75844SAndroid Build Coastguard Worker #define CALL_RECEIVE_STREAM_H_ 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard Worker #include <vector> 15*d9f75844SAndroid Build Coastguard Worker 16*d9f75844SAndroid Build Coastguard Worker #include "api/crypto/frame_decryptor_interface.h" 17*d9f75844SAndroid Build Coastguard Worker #include "api/frame_transformer_interface.h" 18*d9f75844SAndroid Build Coastguard Worker #include "api/media_types.h" 19*d9f75844SAndroid Build Coastguard Worker #include "api/scoped_refptr.h" 20*d9f75844SAndroid Build Coastguard Worker #include "api/transport/rtp/rtp_source.h" 21*d9f75844SAndroid Build Coastguard Worker #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" 22*d9f75844SAndroid Build Coastguard Worker 23*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 24*d9f75844SAndroid Build Coastguard Worker 25*d9f75844SAndroid Build Coastguard Worker // Common base interface for MediaReceiveStreamInterface based classes and 26*d9f75844SAndroid Build Coastguard Worker // FlexfecReceiveStream. 27*d9f75844SAndroid Build Coastguard Worker class ReceiveStreamInterface { 28*d9f75844SAndroid Build Coastguard Worker public: 29*d9f75844SAndroid Build Coastguard Worker // Receive-stream specific RTP settings. 30*d9f75844SAndroid Build Coastguard Worker // TODO(tommi): This struct isn't needed at this level anymore. Move it closer 31*d9f75844SAndroid Build Coastguard Worker // to where it's used. 32*d9f75844SAndroid Build Coastguard Worker struct ReceiveStreamRtpConfig { 33*d9f75844SAndroid Build Coastguard Worker // Synchronization source (stream identifier) to be received. 34*d9f75844SAndroid Build Coastguard Worker // This member will not change mid-stream and can be assumed to be const 35*d9f75844SAndroid Build Coastguard Worker // post initialization. 36*d9f75844SAndroid Build Coastguard Worker uint32_t remote_ssrc = 0; 37*d9f75844SAndroid Build Coastguard Worker 38*d9f75844SAndroid Build Coastguard Worker // Sender SSRC used for sending RTCP (such as receiver reports). 39*d9f75844SAndroid Build Coastguard Worker // This value may change mid-stream and must be done on the same thread 40*d9f75844SAndroid Build Coastguard Worker // that the value is read on (i.e. packet delivery). 41*d9f75844SAndroid Build Coastguard Worker uint32_t local_ssrc = 0; 42*d9f75844SAndroid Build Coastguard Worker 43*d9f75844SAndroid Build Coastguard Worker // Enable feedback for send side bandwidth estimation. 44*d9f75844SAndroid Build Coastguard Worker // See 45*d9f75844SAndroid Build Coastguard Worker // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions 46*d9f75844SAndroid Build Coastguard Worker // for details. 47*d9f75844SAndroid Build Coastguard Worker // This value may change mid-stream and must be done on the same thread 48*d9f75844SAndroid Build Coastguard Worker // that the value is read on (i.e. packet delivery). 49*d9f75844SAndroid Build Coastguard Worker bool transport_cc = false; 50*d9f75844SAndroid Build Coastguard Worker 51*d9f75844SAndroid Build Coastguard Worker // RTP header extensions used for the received stream. 52*d9f75844SAndroid Build Coastguard Worker // This value may change mid-stream and must be done on the same thread 53*d9f75844SAndroid Build Coastguard Worker // that the value is read on (i.e. packet delivery). 54*d9f75844SAndroid Build Coastguard Worker std::vector<RtpExtension> extensions; 55*d9f75844SAndroid Build Coastguard Worker }; 56*d9f75844SAndroid Build Coastguard Worker 57*d9f75844SAndroid Build Coastguard Worker // Set/change the rtp header extensions. Must be called on the packet 58*d9f75844SAndroid Build Coastguard Worker // delivery thread. 59*d9f75844SAndroid Build Coastguard Worker virtual void SetRtpExtensions(std::vector<RtpExtension> extensions) = 0; 60*d9f75844SAndroid Build Coastguard Worker virtual RtpHeaderExtensionMap GetRtpExtensionMap() const = 0; 61*d9f75844SAndroid Build Coastguard Worker 62*d9f75844SAndroid Build Coastguard Worker // Returns a bool for whether feedback for send side bandwidth estimation is 63*d9f75844SAndroid Build Coastguard Worker // enabled. See 64*d9f75844SAndroid Build Coastguard Worker // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions 65*d9f75844SAndroid Build Coastguard Worker // for details. 66*d9f75844SAndroid Build Coastguard Worker // This value may change mid-stream and must be done on the same thread 67*d9f75844SAndroid Build Coastguard Worker // that the value is read on (i.e. packet delivery). 68*d9f75844SAndroid Build Coastguard Worker virtual bool transport_cc() const = 0; 69*d9f75844SAndroid Build Coastguard Worker 70*d9f75844SAndroid Build Coastguard Worker virtual void SetTransportCc(bool transport_cc) = 0; 71*d9f75844SAndroid Build Coastguard Worker 72*d9f75844SAndroid Build Coastguard Worker protected: ~ReceiveStreamInterface()73*d9f75844SAndroid Build Coastguard Worker virtual ~ReceiveStreamInterface() {} 74*d9f75844SAndroid Build Coastguard Worker }; 75*d9f75844SAndroid Build Coastguard Worker 76*d9f75844SAndroid Build Coastguard Worker // Either an audio or video receive stream. 77*d9f75844SAndroid Build Coastguard Worker class MediaReceiveStreamInterface : public ReceiveStreamInterface { 78*d9f75844SAndroid Build Coastguard Worker public: 79*d9f75844SAndroid Build Coastguard Worker // Starts stream activity. 80*d9f75844SAndroid Build Coastguard Worker // When a stream is active, it can receive, process and deliver packets. 81*d9f75844SAndroid Build Coastguard Worker virtual void Start() = 0; 82*d9f75844SAndroid Build Coastguard Worker 83*d9f75844SAndroid Build Coastguard Worker // Stops stream activity. Must be called to match with a previous call to 84*d9f75844SAndroid Build Coastguard Worker // `Start()`. When a stream has been stopped, it won't receive, decode, 85*d9f75844SAndroid Build Coastguard Worker // process or deliver packets to downstream objects such as callback pointers 86*d9f75844SAndroid Build Coastguard Worker // set in the config struct. 87*d9f75844SAndroid Build Coastguard Worker virtual void Stop() = 0; 88*d9f75844SAndroid Build Coastguard Worker 89*d9f75844SAndroid Build Coastguard Worker virtual void SetDepacketizerToDecoderFrameTransformer( 90*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<webrtc::FrameTransformerInterface> 91*d9f75844SAndroid Build Coastguard Worker frame_transformer) = 0; 92*d9f75844SAndroid Build Coastguard Worker 93*d9f75844SAndroid Build Coastguard Worker virtual void SetFrameDecryptor( 94*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) = 0; 95*d9f75844SAndroid Build Coastguard Worker 96*d9f75844SAndroid Build Coastguard Worker virtual std::vector<RtpSource> GetSources() const = 0; 97*d9f75844SAndroid Build Coastguard Worker }; 98*d9f75844SAndroid Build Coastguard Worker 99*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 100*d9f75844SAndroid Build Coastguard Worker 101*d9f75844SAndroid Build Coastguard Worker #endif // CALL_RECEIVE_STREAM_H_ 102