philipel | d5a272f | 2018-02-21 14:30:34 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 16 | namespace webrtc { |
| 17 | namespace video_coding { |
| 18 | |
philipel | d5a272f | 2018-02-21 14:30:34 +0100 | [diff] [blame] | 19 | // TODO(philipel): Remove webrtc::VCMEncodedFrame inheritance. |
philipel | e7c891f | 2018-02-22 14:35:06 +0100 | [diff] [blame^] | 20 | class EncodedFrame : public webrtc::VCMEncodedFrame { |
philipel | d5a272f | 2018-02-21 14:30:34 +0100 | [diff] [blame] | 21 | public: |
| 22 | static const uint8_t kMaxFrameReferences = 5; |
| 23 | |
philipel | e7c891f | 2018-02-22 14:35:06 +0100 | [diff] [blame^] | 24 | EncodedFrame() = default; |
| 25 | virtual ~EncodedFrame() {} |
philipel | d5a272f | 2018-02-21 14:30:34 +0100 | [diff] [blame] | 26 | |
| 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 | |
philipel | e7c891f | 2018-02-22 14:35:06 +0100 | [diff] [blame^] | 61 | // TODO(philipel): Remove this when downstream projects have been updated. |
| 62 | using FrameObject = EncodedFrame; |
| 63 | |
philipel | d5a272f | 2018-02-21 14:30:34 +0100 | [diff] [blame] | 64 | } // namespace video_coding |
| 65 | } // namespace webrtc |
| 66 | |
| 67 | #endif // API_VIDEO_ENCODED_FRAME_H_ |