receive_stream.h (2507B)
1 /* 2 * Copyright (c) 2021 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 CALL_RECEIVE_STREAM_H_ 12 #define CALL_RECEIVE_STREAM_H_ 13 14 #include <cstdint> 15 #include <vector> 16 17 #include "api/crypto/frame_decryptor_interface.h" 18 #include "api/frame_transformer_interface.h" 19 #include "api/rtp_headers.h" 20 #include "api/scoped_refptr.h" 21 #include "api/transport/rtp/rtp_source.h" 22 23 namespace webrtc { 24 25 // Common base interface for MediaReceiveStreamInterface based classes and 26 // FlexfecReceiveStream. 27 class ReceiveStreamInterface { 28 public: 29 // Receive-stream specific RTP settings. 30 // TODO(tommi): This struct isn't needed at this level anymore. Move it closer 31 // to where it's used. 32 struct ReceiveStreamRtpConfig { 33 // Synchronization source (stream identifier) to be received. 34 // This member will not change mid-stream and can be assumed to be const 35 // post initialization. 36 uint32_t remote_ssrc = 0; 37 38 // Sender SSRC used for sending RTCP (such as receiver reports). 39 // This value may change mid-stream and must be done on the same thread 40 // that the value is read on (i.e. packet delivery). 41 uint32_t local_ssrc = 0; 42 }; 43 44 protected: 45 virtual ~ReceiveStreamInterface() {} 46 }; 47 48 // Either an audio or video receive stream. 49 class MediaReceiveStreamInterface : public ReceiveStreamInterface { 50 public: 51 // Starts stream activity. 52 // When a stream is active, it can receive, process and deliver packets. 53 virtual void Start() = 0; 54 55 // Stops stream activity. Must be called to match with a previous call to 56 // `Start()`. When a stream has been stopped, it won't receive, decode, 57 // process or deliver packets to downstream objects such as callback pointers 58 // set in the config struct. 59 virtual void Stop() = 0; 60 61 virtual void SetDepacketizerToDecoderFrameTransformer( 62 scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) = 0; 63 64 virtual void SetFrameDecryptor( 65 scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) = 0; 66 67 virtual std::vector<RtpSource> GetSources() const = 0; 68 69 virtual void SetRtcpMode(RtcpMode mode) = 0; 70 }; 71 72 } // namespace webrtc 73 74 #endif // CALL_RECEIVE_STREAM_H_