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