encoded_frame.h (2858B)
1 /* 2 * Copyright (c) 2011 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 MODULES_VIDEO_CODING_ENCODED_FRAME_H_ 12 #define MODULES_VIDEO_CODING_ENCODED_FRAME_H_ 13 14 #include <cstdint> 15 16 #include "api/video/encoded_image.h" 17 #include "api/video/video_codec_type.h" 18 #include "modules/rtp_rtcp/source/rtp_video_header.h" 19 #include "modules/video_coding/include/video_codec_interface.h" 20 #include "rtc_base/system/rtc_export.h" 21 22 namespace webrtc { 23 24 class RTC_EXPORT VCMEncodedFrame : public EncodedImage { 25 public: 26 VCMEncodedFrame(); 27 VCMEncodedFrame(const VCMEncodedFrame&); 28 29 ~VCMEncodedFrame(); 30 /** 31 * Set render time in milliseconds 32 */ 33 void SetRenderTime(const int64_t renderTimeMs) { 34 _renderTimeMs = renderTimeMs; 35 } 36 37 /** 38 * Get the encoded image 39 */ 40 const EncodedImage& EncodedImage() const { 41 return static_cast<const ::webrtc::EncodedImage&>(*this); 42 } 43 44 using EncodedImage::ColorSpace; 45 using EncodedImage::data; 46 using EncodedImage::GetEncodedData; 47 using EncodedImage::NtpTimeMs; 48 using EncodedImage::PacketInfos; 49 using EncodedImage::RtpTimestamp; 50 using EncodedImage::set_size; 51 using EncodedImage::SetColorSpace; 52 using EncodedImage::SetEncodedData; 53 using EncodedImage::SetPacketInfos; 54 using EncodedImage::SetRtpTimestamp; 55 using EncodedImage::SetSpatialIndex; 56 using EncodedImage::SetSpatialLayerFrameSize; 57 using EncodedImage::size; 58 using EncodedImage::SpatialIndex; 59 using EncodedImage::SpatialLayerFrameSize; 60 61 /** 62 * Get render time in milliseconds 63 */ 64 int64_t RenderTimeMs() const { return _renderTimeMs; } 65 /** 66 * True if there's a frame missing before this frame 67 */ 68 bool MissingFrame() const { return _missingFrame; } 69 /** 70 * Payload type of the encoded payload 71 */ 72 uint8_t PayloadType() const { return _payloadType; } 73 /** 74 * Get codec specific info. 75 * The returned pointer is only valid as long as the VCMEncodedFrame 76 * is valid. Also, VCMEncodedFrame owns the pointer and will delete 77 * the object. 78 */ 79 const CodecSpecificInfo* CodecSpecific() const { return &_codecSpecificInfo; } 80 void SetCodecSpecific(const CodecSpecificInfo* codec_specific) { 81 _codecSpecificInfo = *codec_specific; 82 } 83 84 protected: 85 void Reset(); 86 87 void CopyCodecSpecific(const RTPVideoHeader* header); 88 89 int64_t _renderTimeMs; 90 uint8_t _payloadType; 91 bool _missingFrame; 92 CodecSpecificInfo _codecSpecificInfo; 93 VideoCodecType _codec; 94 }; 95 96 } // namespace webrtc 97 98 #endif // MODULES_VIDEO_CODING_ENCODED_FRAME_H_