frame_buffer.h (2846B)
1 /* 2 * Copyright (c) 2012 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_DEPRECATED_FRAME_BUFFER_H_ 12 #define MODULES_VIDEO_CODING_DEPRECATED_FRAME_BUFFER_H_ 13 14 #include <stddef.h> 15 #include <stdint.h> 16 17 #include <vector> 18 19 #include "api/scoped_refptr.h" 20 #include "api/video/encoded_image.h" 21 #include "api/video/video_frame_type.h" 22 #include "modules/video_coding/codecs/h264/include/h264_globals.h" 23 #include "modules/video_coding/codecs/vp9/include/vp9_globals.h" 24 #include "modules/video_coding/deprecated/jitter_buffer_common.h" 25 #include "modules/video_coding/deprecated/packet.h" 26 #include "modules/video_coding/deprecated/session_info.h" 27 #include "modules/video_coding/encoded_frame.h" 28 29 namespace webrtc { 30 31 class VCMFrameBuffer : public VCMEncodedFrame { 32 public: 33 VCMFrameBuffer(); 34 virtual ~VCMFrameBuffer(); 35 36 virtual void Reset(); 37 38 VCMFrameBufferEnum InsertPacket(const VCMPacket& packet, 39 int64_t timeInMs, 40 const FrameData& frame_data); 41 42 // State 43 // Get current state of frame 44 VCMFrameBufferStateEnum GetState() const; 45 void PrepareForDecode(bool continuous); 46 47 bool IsSessionComplete() const; 48 bool HaveFirstPacket() const; 49 int NumPackets() const; 50 51 // Sequence numbers 52 // Get lowest packet sequence number in frame 53 int32_t GetLowSeqNum() const; 54 // Get highest packet sequence number in frame 55 int32_t GetHighSeqNum() const; 56 57 int PictureId() const; 58 int TemporalId() const; 59 bool LayerSync() const; 60 int Tl0PicId() const; 61 62 std::vector<NaluInfo> GetNaluInfos() const; 63 64 void SetGofInfo(const GofInfoVP9& gof_info, size_t idx); 65 66 // Increments a counter to keep track of the number of packets of this frame 67 // which were NACKed before they arrived. 68 void IncrementNackCount(); 69 // Returns the number of packets of this frame which were NACKed before they 70 // arrived. 71 int16_t GetNackCount() const; 72 73 int64_t LatestPacketTimeMs() const; 74 75 VideoFrameType FrameType() const; 76 77 private: 78 void SetState(VCMFrameBufferStateEnum state); // Set state of frame 79 80 VCMFrameBufferStateEnum _state; // Current state of the frame 81 // Set with SetEncodedData, but keep pointer to the concrete class here, to 82 // enable reallocation and mutation. 83 scoped_refptr<EncodedImageBuffer> encoded_image_buffer_; 84 VCMSessionInfo _sessionInfo; 85 uint16_t _nackCount; 86 int64_t _latestPacketTimeMs; 87 }; 88 89 } // namespace webrtc 90 91 #endif // MODULES_VIDEO_CODING_DEPRECATED_FRAME_BUFFER_H_