blob: 1373eaa19d317137375888297a151b565320b42f [file] [log] [blame]
philipeld5a272f2018-02-21 14:30:34 +01001/*
2 * Copyright (c) 2016 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 API_VIDEO_ENCODED_FRAME_H_
12#define API_VIDEO_ENCODED_FRAME_H_
13
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stddef.h>
15#include <stdint.h>
16
Jonas Olssona4d87372019-07-05 19:08:33 +020017#include "modules/video_coding/encoded_frame.h"
18
philipeld5a272f2018-02-21 14:30:34 +010019namespace webrtc {
20namespace video_coding {
21
philipel9aa9b8d2021-02-15 13:31:29 +010022// TODO(bugs.webrtc.org/12206): Remove when downstream has been updated.
philipel0fa82a62018-03-19 15:34:53 +010023struct VideoLayerFrameId {
philipel9aa9b8d2021-02-15 13:31:29 +010024 int64_t picture_id = -1;
philipel0fa82a62018-03-19 15:34:53 +010025};
26
philipeld5a272f2018-02-21 14:30:34 +010027// TODO(philipel): Remove webrtc::VCMEncodedFrame inheritance.
philipel0fa82a62018-03-19 15:34:53 +010028// TODO(philipel): Move transport specific info out of EncodedFrame.
29// NOTE: This class is still under development and may change without notice.
philipele7c891f2018-02-22 14:35:06 +010030class EncodedFrame : public webrtc::VCMEncodedFrame {
philipeld5a272f2018-02-21 14:30:34 +010031 public:
32 static const uint8_t kMaxFrameReferences = 5;
33
philipele7c891f2018-02-22 14:35:06 +010034 EncodedFrame() = default;
philipel6c42d922019-06-20 11:13:03 +020035 EncodedFrame(const EncodedFrame&) = default;
philipele7c891f2018-02-22 14:35:06 +010036 virtual ~EncodedFrame() {}
philipeld5a272f2018-02-21 14:30:34 +010037
philipeld5a272f2018-02-21 14:30:34 +010038 // When this frame was received.
39 virtual int64_t ReceivedTime() const = 0;
40
41 // When this frame should be rendered.
42 virtual int64_t RenderTime() const = 0;
43
44 // This information is currently needed by the timing calculation class.
45 // TODO(philipel): Remove this function when a new timing class has
46 // been implemented.
Niels Möllerbe682d42018-03-27 08:31:45 +020047 virtual bool delayed_by_retransmission() const;
philipeld5a272f2018-02-21 14:30:34 +010048
philipeld5a272f2018-02-21 14:30:34 +010049 bool is_keyframe() const { return num_references == 0; }
50
philipel9aa9b8d2021-02-15 13:31:29 +010051 // TODO(bugs.webrtc.org/12206): Replace with private int64_t when downstream
52 // has been updated.
philipel0fa82a62018-03-19 15:34:53 +010053 VideoLayerFrameId id;
philipeld5a272f2018-02-21 14:30:34 +010054
philipel9aa9b8d2021-02-15 13:31:29 +010055 void SetId(int64_t frame_id) { id.picture_id = frame_id; }
56 int64_t Id() const { return id.picture_id; }
57
philipeld5a272f2018-02-21 14:30:34 +010058 // TODO(philipel): Add simple modify/access functions to prevent adding too
59 // many |references|.
60 size_t num_references = 0;
61 int64_t references[kMaxFrameReferences];
Ilya Nikolaevskiy5546aef2018-12-04 15:54:52 +010062 // Is this subframe the last one in the superframe (In RTP stream that would
63 // mean that the last packet has a marker bit set).
64 bool is_last_spatial_layer = true;
philipeld5a272f2018-02-21 14:30:34 +010065};
66
philipeld5a272f2018-02-21 14:30:34 +010067} // namespace video_coding
68} // namespace webrtc
69
70#endif // API_VIDEO_ENCODED_FRAME_H_