Twitch SDK (Internal)
videoframequeue.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
13 #include <list>
14 
15 namespace ttv
16 {
17  class IThread;
18  class IMutex;
19 
20  namespace broadcast
21  {
22  class VideoFrameQueue;
23  }
24 }
25 
26 
28 {
29 public:
31 
32  void SetFPS(uint fps);
33  TTV_ErrorCode AddFrame(const std::shared_ptr<VideoFrame>& frame);
34  std::shared_ptr<VideoFrame> GetNextFrame(uint64_t currentTime);
35  void Shutdown();
36 
43 
44 private:
45  std::shared_ptr<IMutex> mMutex;
46  std::list< std::shared_ptr<VideoFrame> > mQueuedVideoFrames; // If frame dropping is allowed then this will have at most one frame in it.
47 
48  // Member used when allowing drops and reuse
49  std::shared_ptr<VideoFrame> mLastProcessedFrame; // The last frame that was returned from GetNextFrame().
50 
53 
54  uint64_t mFrameDuration;
55  uint64_t mTimeOfNextFrame;
58 
60 };
uint64_t mTimeOfNextKeyFrame
Definition: videoframequeue.h:56
TTV_ErrorCode AddFrame(const std::shared_ptr< VideoFrame > &frame)
void SetAllowFrameDroppingAndReuse(bool allow)
Definition: videoframequeue.h:42
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
std::shared_ptr< VideoFrame > GetNextFrame(uint64_t currentTime)
uint64_t mTimeOfLastSubmittedFrame
Definition: videoframequeue.h:57
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
uint64_t mTimeOfNextFrame
Definition: videoframequeue.h:55
uint64_t mFrameDuration
Definition: videoframequeue.h:54
unsigned int uint
Definition: coretypes.h:18
Definition: videoframequeue.h:27
std::list< std::shared_ptr< VideoFrame > > mQueuedVideoFrames
Definition: videoframequeue.h:46
bool mAllowFrameDroppingAndReuse
Definition: videoframequeue.h:59
std::shared_ptr< VideoFrame > mLastProcessedFrame
Definition: videoframequeue.h:49
std::shared_ptr< IMutex > mMutex
Definition: videoframequeue.h:45
uint mNumFramesDropped
Definition: videoframequeue.h:51
uint mNumFramesProcessed
Definition: videoframequeue.h:52