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