niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CODING_RECEIVER_H_ |
| 12 | #define MODULES_VIDEO_CODING_RECEIVER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 13 | |
kwiberg | 3f55dea | 2016-02-29 13:51:59 | [diff] [blame] | 14 | #include <memory> |
philipel | 9d3ab61 | 2015-12-21 12:12:39 | [diff] [blame] | 15 | #include <vector> |
| 16 | |
Jonas Oreland | e62c2f2 | 2022-03-29 09:04:48 | [diff] [blame] | 17 | #include "api/field_trials_view.h" |
Niels Möller | d3da6b0 | 2020-03-05 14:31:10 | [diff] [blame] | 18 | #include "modules/video_coding/event_wrapper.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 19 | #include "modules/video_coding/include/video_coding.h" |
| 20 | #include "modules/video_coding/include/video_coding_defines.h" |
| 21 | #include "modules/video_coding/jitter_buffer.h" |
| 22 | #include "modules/video_coding/packet.h" |
Rasmus Brandt | c4d253c | 2022-05-25 10:03:35 | [diff] [blame] | 23 | #include "modules/video_coding/timing/timing.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 24 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 25 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 26 | |
stefan@webrtc.org | a678a3b | 2013-01-21 07:42:11 | [diff] [blame] | 27 | class Clock; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 28 | class VCMEncodedFrame; |
| 29 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 30 | class VCMReceiver { |
| 31 | public: |
Jonas Oreland | e02f9ee | 2022-03-25 11:43:14 | [diff] [blame] | 32 | VCMReceiver(VCMTiming* timing, |
| 33 | Clock* clock, |
Jonas Oreland | e62c2f2 | 2022-03-29 09:04:48 | [diff] [blame] | 34 | const FieldTrialsView& field_trials); |
Qiang Chen | d4cec15 | 2015-06-19 16:17:00 | [diff] [blame] | 35 | |
Niels Möller | 689983f | 2018-11-07 15:36:22 | [diff] [blame] | 36 | // Using this constructor, you can specify a different event implemetation for |
| 37 | // the jitter buffer. Useful for unit tests when you want to simulate incoming |
Qiang Chen | d4cec15 | 2015-06-19 16:17:00 | [diff] [blame] | 38 | // packets, in which case the jitter buffer's wait event is different from |
| 39 | // that of VCMReceiver itself. |
| 40 | VCMReceiver(VCMTiming* timing, |
| 41 | Clock* clock, |
kwiberg | 3f55dea | 2016-02-29 13:51:59 | [diff] [blame] | 42 | std::unique_ptr<EventWrapper> receiver_event, |
Jonas Oreland | e02f9ee | 2022-03-25 11:43:14 | [diff] [blame] | 43 | std::unique_ptr<EventWrapper> jitter_buffer_event, |
Jonas Oreland | e62c2f2 | 2022-03-29 09:04:48 | [diff] [blame] | 44 | const FieldTrialsView& field_trials); |
Qiang Chen | d4cec15 | 2015-06-19 16:17:00 | [diff] [blame] | 45 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 46 | ~VCMReceiver(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 47 | |
Johan Ahlers | 95348f7 | 2016-06-28 09:11:28 | [diff] [blame] | 48 | int32_t InsertPacket(const VCMPacket& packet); |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 49 | VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms, |
perkj | 796cfaf | 2015-12-10 17:27:38 | [diff] [blame] | 50 | bool prefer_late_decoding); |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 51 | void ReleaseFrame(VCMEncodedFrame* frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 52 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 53 | // NACK. |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 | [diff] [blame] | 54 | void SetNackSettings(size_t max_nack_list_size, |
stefan@webrtc.org | ef14488 | 2013-05-07 19:16:33 | [diff] [blame] | 55 | int max_packet_age_to_nack, |
| 56 | int max_incomplete_time_ms); |
Wan-Teh Chang | b1825a4 | 2015-06-03 22:03:35 | [diff] [blame] | 57 | std::vector<uint16_t> NackList(bool* request_key_frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 58 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 59 | private: |
pbos@webrtc.org | 4dd40d6 | 2015-02-17 13:22:43 | [diff] [blame] | 60 | Clock* const clock_; |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 61 | VCMJitterBuffer jitter_buffer_; |
| 62 | VCMTiming* timing_; |
kwiberg | 3f55dea | 2016-02-29 13:51:59 | [diff] [blame] | 63 | std::unique_ptr<EventWrapper> render_wait_event_; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 | [diff] [blame] | 64 | int max_video_delay_ms_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 65 | }; |
| 66 | |
stefan@webrtc.org | 1ea4b50 | 2013-01-07 08:49:41 | [diff] [blame] | 67 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 68 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 69 | #endif // MODULES_VIDEO_CODING_RECEIVER_H_ |