MythTV  master
Functions | Variables
videobuffers.cpp File Reference
#include <chrono>
#include <thread>
#include "libmyth/mythcontext.h"
#include "libmythbase/compat.h"
#include "libmythbase/mythconfig.h"
#include "libmythbase/mythlogging.h"
#include "fourcc.h"
#include "mythcodecid.h"
#include "videobuffers.h"
#include "libavcodec/avcodec.h"
Include dependency graph for videobuffers.cpp:

Go to the source code of this file.

Functions

static void ReleaseDecoderResources (MythVideoFrame *Frame, std::vector< AVBufferRef * > &Discards)
 Store AVBufferRef's for later disposal. More...
 
static void DoDiscard (const std::vector< AVBufferRef * > &Discards)
 
static unsigned long long to_bitmap (const frame_queue_t &Queue, int Num)
 
static int DebugNum (const MythVideoFrame *Frame)
 
const QString & DebugString (const MythVideoFrame *Frame, bool Short)
 
const QString & DebugString (uint FrameNum, bool Short)
 

Variables

static constexpr uint16_t TRY_LOCK_SPINS { 2000 }
 
static constexpr uint16_t TRY_LOCK_SPINS_BEFORE_WARNING { 9999 }
 
static constexpr std::chrono::milliseconds TRY_LOCK_SPIN_WAIT { 1ms }
 
int next_dbg_str = 0
 
static constexpr size_t DBG_STR_ARR_SIZE { 40 }
 
const std::array< const QString, DBG_STR_ARR_SIZEdbg_str_arr
 
const std::array< const QString, DBG_STR_ARR_SIZEdbg_str_arr_short
 
std::map< const MythVideoFrame *, int > dbg_str
 

Function Documentation

◆ ReleaseDecoderResources()

static void ReleaseDecoderResources ( MythVideoFrame Frame,
std::vector< AVBufferRef * > &  Discards 
)
inlinestatic

Store AVBufferRef's for later disposal.

Note
Releasing hardware buffer references will at some point trigger the deletion of AVBufferPool's, which in turn trigger the release of hardware contexts and OpenGL interops - which may trigger a blocking callback. We cannot hold the videobuffer lock while doing this as there are numerous playback paths that can request the video buffer lock while the decoder thread is blocking. So store the buffers and release once the master videobuffer lock is released.

Definition at line 38 of file videobuffers.cpp.

Referenced by VideoBuffers::ClearAfterSeek(), VideoBuffers::DeLimboFrame(), VideoBuffers::DiscardAndRecreate(), VideoBuffers::DiscardFrame(), VideoBuffers::DiscardFrames(), VideoBuffers::DiscardPauseFrames(), and VideoBuffers::DoneDisplayingFrame().

◆ DoDiscard()

static void DoDiscard ( const std::vector< AVBufferRef * > &  Discards)
inlinestatic

◆ to_bitmap()

static unsigned long long to_bitmap ( const frame_queue_t Queue,
int  Num 
)
static

Definition at line 1110 of file videobuffers.cpp.

Referenced by VideoBuffers::GetStatus().

◆ DebugNum()

static int DebugNum ( const MythVideoFrame Frame)
static

Definition at line 1090 of file videobuffers.cpp.

Referenced by DebugString(), and to_bitmap().

◆ DebugString() [1/2]

const QString& DebugString ( const MythVideoFrame Frame,
bool  Short 
)

◆ DebugString() [2/2]

const QString& DebugString ( uint  FrameNum,
bool  Short 
)

Definition at line 1105 of file videobuffers.cpp.

Variable Documentation

◆ TRY_LOCK_SPINS

constexpr uint16_t TRY_LOCK_SPINS { 2000 }
staticconstexpr

Definition at line 23 of file videobuffers.cpp.

Referenced by VideoBuffers::GetNextFreeFrame().

◆ TRY_LOCK_SPINS_BEFORE_WARNING

constexpr uint16_t TRY_LOCK_SPINS_BEFORE_WARNING { 9999 }
staticconstexpr

Definition at line 24 of file videobuffers.cpp.

Referenced by VideoBuffers::GetNextFreeFrame().

◆ TRY_LOCK_SPIN_WAIT

constexpr std::chrono::milliseconds TRY_LOCK_SPIN_WAIT { 1ms }
staticconstexpr

Definition at line 25 of file videobuffers.cpp.

Referenced by VideoBuffers::GetNextFreeFrame().

◆ next_dbg_str

int next_dbg_str = 0

Definition at line 27 of file videobuffers.cpp.

Referenced by DebugNum().

◆ DBG_STR_ARR_SIZE

constexpr size_t DBG_STR_ARR_SIZE { 40 }
staticconstexpr

Definition at line 1065 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str_arr

const std::array<const QString,DBG_STR_ARR_SIZE> dbg_str_arr
Initial value:
{
"A ", " B ", " C ", " D ",
" E ", " F ", " G ", " H",
"a ", " b ", " c ", " d ",
" e ", " f ", " g ", " h",
"0 ", " 1 ", " 2 ", " 3 ",
" 4 ", " 5 ", " 6 ", " 7",
"I ", " J ", " K ", " L ",
" M ", " N ", " O ", " P",
"i ", " j ", " k ", " l ",
" m ", " n ", " o ", " p",
}

Definition at line 1067 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str_arr_short

const std::array<const QString,DBG_STR_ARR_SIZE> dbg_str_arr_short
Initial value:
{
"A","B","C","D","E","F","G","H",
"a","b","c","d","e","f","g","h",
"0","1","2","3","4","5","6","7",
"I","J","K","L","M","N","O","P",
"i","j","k","l","m","n","o","p",
}

Definition at line 1080 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str

std::map<const MythVideoFrame *, int> dbg_str

Definition at line 1088 of file videobuffers.cpp.

Referenced by DebugNum().