blob: a65a4b4dd85a05a59e1f3f91a96a5e8b1e437477 [file] [log] [blame]
philipelc707ab72016-04-01 02:01:54 -07001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_FRAME_OBJECT_H_
12#define MODULES_VIDEO_CODING_FRAME_OBJECT_H_
philipelc707ab72016-04-01 02:01:54 -070013
Danil Chapovalov0040b662018-06-18 10:48:16 +020014#include "absl/types/optional.h"
philipeld5a272f2018-02-21 14:30:34 +010015#include "api/video/encoded_frame.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020016#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "modules/include/module_common_types.h"
philipel2837edc2018-10-02 13:55:47 +020018#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h"
philipelc707ab72016-04-01 02:01:54 -070019
20namespace webrtc {
21namespace video_coding {
22
philipelc707ab72016-04-01 02:01:54 -070023class PacketBuffer;
24
philipele7c891f2018-02-22 14:35:06 +010025class RtpFrameObject : public EncodedFrame {
philipelc707ab72016-04-01 02:01:54 -070026 public:
27 RtpFrameObject(PacketBuffer* packet_buffer,
philipel02447bc2016-05-13 06:01:03 -070028 uint16_t first_seq_num,
philipel5ceaaae2016-05-24 10:20:47 +020029 uint16_t last_seq_num,
30 size_t frame_size,
philipelb4d31082016-07-11 08:46:29 -070031 int times_nacked,
32 int64_t received_time);
philipelf4139332016-04-20 10:26:34 +020033
philipelc707ab72016-04-01 02:01:54 -070034 ~RtpFrameObject();
philipelf4139332016-04-20 10:26:34 +020035 uint16_t first_seq_num() const;
36 uint16_t last_seq_num() const;
philipel5ceaaae2016-05-24 10:20:47 +020037 int times_nacked() const;
philipel552866c2016-07-04 16:18:55 +020038 enum FrameType frame_type() const;
philipel02447bc2016-05-13 06:01:03 -070039 VideoCodecType codec_type() const;
philipelb4d31082016-07-11 08:46:29 -070040 int64_t ReceivedTime() const override;
41 int64_t RenderTime() const override;
philipele0754302017-01-25 08:56:23 -080042 bool delayed_by_retransmission() const override;
philipel5470f402018-09-07 13:38:53 +020043 absl::optional<RTPVideoHeader> GetRtpVideoHeader() const;
philipel2837edc2018-10-02 13:55:47 +020044 absl::optional<RtpGenericFrameDescriptor> GetGenericFrameDescriptor() const;
Johnny Leee0c8b232018-09-11 16:50:49 -040045 absl::optional<FrameMarking> GetFrameMarking() const;
philipelc707ab72016-04-01 02:01:54 -070046
47 private:
philipel5fb24542018-10-02 17:01:45 +020048 void AllocateBitstreamBuffer(size_t frame_size);
49
philipel17deeb42016-08-11 15:09:26 +020050 rtc::scoped_refptr<PacketBuffer> packet_buffer_;
philipel552866c2016-07-04 16:18:55 +020051 enum FrameType frame_type_;
philipel02447bc2016-05-13 06:01:03 -070052 VideoCodecType codec_type_;
53 uint16_t first_seq_num_;
54 uint16_t last_seq_num_;
philipelb4d31082016-07-11 08:46:29 -070055 int64_t received_time_;
philipel5ceaaae2016-05-24 10:20:47 +020056
57 // Equal to times nacked of the packet with the highet times nacked
58 // belonging to this frame.
59 int times_nacked_;
philipelc707ab72016-04-01 02:01:54 -070060};
61
62} // namespace video_coding
63} // namespace webrtc
64
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020065#endif // MODULES_VIDEO_CODING_FRAME_OBJECT_H_