blob: 09b05921cb5d55bd46c6fbe983e1213f27cf1401 [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
14#include "modules/video_coding/encoded_frame.h"
15
16namespace webrtc {
17namespace video_coding {
18
philipeld5a272f2018-02-21 14:30:34 +010019// TODO(philipel): Remove webrtc::VCMEncodedFrame inheritance.
philipele7c891f2018-02-22 14:35:06 +010020class EncodedFrame : public webrtc::VCMEncodedFrame {
philipeld5a272f2018-02-21 14:30:34 +010021 public:
22 static const uint8_t kMaxFrameReferences = 5;
23
philipele7c891f2018-02-22 14:35:06 +010024 EncodedFrame() = default;
25 virtual ~EncodedFrame() {}
philipeld5a272f2018-02-21 14:30:34 +010026
27 virtual bool GetBitstream(uint8_t* destination) const = 0;
28
29 // The capture timestamp of this frame.
30 virtual uint32_t Timestamp() const = 0;
31
32 // When this frame was received.
33 virtual int64_t ReceivedTime() const = 0;
34
35 // When this frame should be rendered.
36 virtual int64_t RenderTime() const = 0;
37
38 // This information is currently needed by the timing calculation class.
39 // TODO(philipel): Remove this function when a new timing class has
40 // been implemented.
41 virtual bool delayed_by_retransmission() const { return 0; }
42
43 size_t size() const { return _length; }
44
45 bool is_keyframe() const { return num_references == 0; }
46
47 // The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame
48 // object. For codec types that don't necessarily have picture ids they
49 // have to be constructed from the header data relevant to that codec.
50 int64_t picture_id = 0;
51 uint8_t spatial_layer = 0;
52 uint32_t timestamp = 0;
53
54 // TODO(philipel): Add simple modify/access functions to prevent adding too
55 // many |references|.
56 size_t num_references = 0;
57 int64_t references[kMaxFrameReferences];
58 bool inter_layer_predicted = false;
59};
60
philipele7c891f2018-02-22 14:35:06 +010061// TODO(philipel): Remove this when downstream projects have been updated.
62using FrameObject = EncodedFrame;
63
philipeld5a272f2018-02-21 14:30:34 +010064} // namespace video_coding
65} // namespace webrtc
66
67#endif // API_VIDEO_ENCODED_FRAME_H_