blob: 069f8c55c7e6af9cb723aec683a1c054bb709f9a [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
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 Bonadei92ea95e2017-09-15 04:47:3111#ifndef MODULES_VIDEO_CODING_RECEIVER_H_
12#define MODULES_VIDEO_CODING_RECEIVER_H_
niklase@google.com470e71d2011-07-07 08:21:2513
kwiberg3f55dea2016-02-29 13:51:5914#include <memory>
philipel9d3ab612015-12-21 12:12:3915#include <vector>
16
Jonas Orelande62c2f22022-03-29 09:04:4817#include "api/field_trials_view.h"
Niels Möllerd3da6b02020-03-05 14:31:1018#include "modules/video_coding/event_wrapper.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3119#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 Brandtc4d253c2022-05-25 10:03:3523#include "modules/video_coding/timing/timing.h"
niklase@google.com470e71d2011-07-07 08:21:2524
stefan@webrtc.org1ea4b502013-01-07 08:49:4125namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:2526
stefan@webrtc.orga678a3b2013-01-21 07:42:1127class Clock;
niklase@google.com470e71d2011-07-07 08:21:2528class VCMEncodedFrame;
29
stefan@webrtc.org1ea4b502013-01-07 08:49:4130class VCMReceiver {
31 public:
Jonas Orelande02f9ee2022-03-25 11:43:1432 VCMReceiver(VCMTiming* timing,
33 Clock* clock,
Jonas Orelande62c2f22022-03-29 09:04:4834 const FieldTrialsView& field_trials);
Qiang Chend4cec152015-06-19 16:17:0035
Niels Möller689983f2018-11-07 15:36:2236 // 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 Chend4cec152015-06-19 16:17:0038 // 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,
kwiberg3f55dea2016-02-29 13:51:5942 std::unique_ptr<EventWrapper> receiver_event,
Jonas Orelande02f9ee2022-03-25 11:43:1443 std::unique_ptr<EventWrapper> jitter_buffer_event,
Jonas Orelande62c2f22022-03-29 09:04:4844 const FieldTrialsView& field_trials);
Qiang Chend4cec152015-06-19 16:17:0045
stefan@webrtc.org1ea4b502013-01-07 08:49:4146 ~VCMReceiver();
niklase@google.com470e71d2011-07-07 08:21:2547
Johan Ahlers95348f72016-06-28 09:11:2848 int32_t InsertPacket(const VCMPacket& packet);
stefan@webrtc.org1ea4b502013-01-07 08:49:4149 VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
perkj796cfaf2015-12-10 17:27:3850 bool prefer_late_decoding);
stefan@webrtc.org1ea4b502013-01-07 08:49:4151 void ReleaseFrame(VCMEncodedFrame* frame);
niklase@google.com470e71d2011-07-07 08:21:2552
stefan@webrtc.org1ea4b502013-01-07 08:49:4153 // NACK.
stefan@webrtc.orgbecf9c82013-02-01 15:09:5754 void SetNackSettings(size_t max_nack_list_size,
stefan@webrtc.orgef144882013-05-07 19:16:3355 int max_packet_age_to_nack,
56 int max_incomplete_time_ms);
Wan-Teh Changb1825a42015-06-03 22:03:3557 std::vector<uint16_t> NackList(bool* request_key_frame);
niklase@google.com470e71d2011-07-07 08:21:2558
stefan@webrtc.org1ea4b502013-01-07 08:49:4159 private:
pbos@webrtc.org4dd40d62015-02-17 13:22:4360 Clock* const clock_;
stefan@webrtc.org1ea4b502013-01-07 08:49:4161 VCMJitterBuffer jitter_buffer_;
62 VCMTiming* timing_;
kwiberg3f55dea2016-02-29 13:51:5963 std::unique_ptr<EventWrapper> render_wait_event_;
mikhal@webrtc.orgef9f76a2013-02-15 23:22:1864 int max_video_delay_ms_;
niklase@google.com470e71d2011-07-07 08:21:2565};
66
stefan@webrtc.org1ea4b502013-01-07 08:49:4167} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:2568
Mirko Bonadei92ea95e2017-09-15 04:47:3169#endif // MODULES_VIDEO_CODING_RECEIVER_H_