OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |
13 | 13 |
14 #include "webrtc/common_types.h" | 14 #include "webrtc/common_types.h" |
15 #include "webrtc/modules/include/module_common_types.h" | 15 #include "webrtc/modules/include/module_common_types.h" |
16 #include "webrtc/modules/video_coding/encoded_frame.h" | 16 #include "webrtc/modules/video_coding/encoded_frame.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 namespace video_coding { | 19 namespace video_coding { |
20 | 20 |
21 class FrameObject : public webrtc::VCMEncodedFrame { | 21 class FrameObject : public webrtc::VCMEncodedFrame { |
22 public: | 22 public: |
23 static const uint8_t kMaxFrameReferences = 5; | 23 static const uint8_t kMaxFrameReferences = 5; |
24 | 24 |
25 FrameObject(); | 25 FrameObject(); |
26 virtual ~FrameObject() {} | 26 virtual ~FrameObject() {} |
27 | 27 |
28 virtual bool GetBitstream(uint8_t* destination) const = 0; | |
29 | |
30 // The capture timestamp of this frame. | 28 // The capture timestamp of this frame. |
31 virtual uint32_t Timestamp() const = 0; | 29 virtual uint32_t Timestamp() const = 0; |
32 | 30 |
33 // When this frame was received. | 31 // When this frame was received. |
34 virtual int64_t ReceivedTime() const = 0; | 32 virtual int64_t ReceivedTime() const = 0; |
35 | 33 |
36 // When this frame should be rendered. | 34 // When this frame should be rendered. |
37 virtual int64_t RenderTime() const = 0; | 35 virtual int64_t RenderTime() const = 0; |
38 | 36 |
| 37 size_t size() { return _size; } |
39 | 38 |
40 // The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame | 39 // The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame |
41 // object. For codec types that don't necessarily have picture ids they | 40 // object. For codec types that don't necessarily have picture ids they |
42 // have to be constructed from the header data relevant to that codec. | 41 // have to be constructed from the header data relevant to that codec. |
43 uint16_t picture_id; | 42 uint16_t picture_id; |
44 uint8_t spatial_layer; | 43 uint8_t spatial_layer; |
45 uint32_t timestamp; | 44 uint32_t timestamp; |
46 | 45 |
47 size_t num_references; | 46 size_t num_references; |
48 uint16_t references[kMaxFrameReferences]; | 47 uint16_t references[kMaxFrameReferences]; |
49 bool inter_layer_predicted; | 48 bool inter_layer_predicted; |
50 | |
51 size_t size; | |
52 }; | 49 }; |
53 | 50 |
54 class PacketBuffer; | 51 class PacketBuffer; |
55 | 52 |
56 class RtpFrameObject : public FrameObject { | 53 class RtpFrameObject : public FrameObject { |
57 public: | 54 public: |
58 RtpFrameObject(PacketBuffer* packet_buffer, | 55 RtpFrameObject(PacketBuffer* packet_buffer, |
59 uint16_t first_seq_num, | 56 uint16_t first_seq_num, |
60 uint16_t last_seq_num, | 57 uint16_t last_seq_num, |
61 size_t frame_size, | 58 size_t frame_size, |
62 int times_nacked, | 59 int times_nacked, |
63 int64_t received_time); | 60 int64_t received_time); |
64 | 61 |
65 ~RtpFrameObject(); | 62 ~RtpFrameObject(); |
66 uint16_t first_seq_num() const; | 63 uint16_t first_seq_num() const; |
67 uint16_t last_seq_num() const; | 64 uint16_t last_seq_num() const; |
68 int times_nacked() const; | 65 int times_nacked() const; |
69 enum FrameType frame_type() const; | 66 enum FrameType frame_type() const; |
70 VideoCodecType codec_type() const; | 67 VideoCodecType codec_type() const; |
71 bool GetBitstream(uint8_t* destination) const override; | |
72 uint32_t Timestamp() const override; | 68 uint32_t Timestamp() const override; |
73 int64_t ReceivedTime() const override; | 69 int64_t ReceivedTime() const override; |
74 int64_t RenderTime() const override; | 70 int64_t RenderTime() const override; |
75 RTPVideoTypeHeader* GetCodecHeader() const; | 71 RTPVideoTypeHeader* GetCodecHeader() const; |
76 | 72 |
77 private: | 73 private: |
78 rtc::scoped_refptr<PacketBuffer> packet_buffer_; | 74 rtc::scoped_refptr<PacketBuffer> packet_buffer_; |
79 enum FrameType frame_type_; | 75 enum FrameType frame_type_; |
80 VideoCodecType codec_type_; | 76 VideoCodecType codec_type_; |
81 uint16_t first_seq_num_; | 77 uint16_t first_seq_num_; |
82 uint16_t last_seq_num_; | 78 uint16_t last_seq_num_; |
83 uint32_t timestamp_; | 79 uint32_t timestamp_; |
84 int64_t received_time_; | 80 int64_t received_time_; |
85 | 81 |
86 // Equal to times nacked of the packet with the highet times nacked | 82 // Equal to times nacked of the packet with the highet times nacked |
87 // belonging to this frame. | 83 // belonging to this frame. |
88 int times_nacked_; | 84 int times_nacked_; |
89 }; | 85 }; |
90 | 86 |
91 } // namespace video_coding | 87 } // namespace video_coding |
92 } // namespace webrtc | 88 } // namespace webrtc |
93 | 89 |
94 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ | 90 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |
OLD | NEW |