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

Go to the source code of this file.

Macros

#define TRY_LOCK_SPINS   2000
 
#define TRY_LOCK_SPINS_BEFORE_WARNING   9999
 
#define TRY_LOCK_SPIN_WAIT   1000 /* usec */
 
#define DBG_STR_ARR_SIZE   40
 

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

int next_dbg_str = 0
 
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
 

Macro Definition Documentation

◆ TRY_LOCK_SPINS

#define TRY_LOCK_SPINS   2000

Definition at line 22 of file videobuffers.cpp.

◆ TRY_LOCK_SPINS_BEFORE_WARNING

#define TRY_LOCK_SPINS_BEFORE_WARNING   9999

Definition at line 23 of file videobuffers.cpp.

◆ TRY_LOCK_SPIN_WAIT

#define TRY_LOCK_SPIN_WAIT   1000 /* usec */

Definition at line 24 of file videobuffers.cpp.

◆ DBG_STR_ARR_SIZE

#define DBG_STR_ARR_SIZE   40

Definition at line 1073 of file videobuffers.cpp.

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 37 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 1118 of file videobuffers.cpp.

Referenced by VideoBuffers::GetStatus().

◆ DebugNum()

static int DebugNum ( const MythVideoFrame Frame)
static

Definition at line 1098 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 1113 of file videobuffers.cpp.

Variable Documentation

◆ next_dbg_str

int next_dbg_str = 0

Definition at line 26 of file videobuffers.cpp.

Referenced by DebugNum().

◆ 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 1074 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 1087 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str

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

Definition at line 1096 of file videobuffers.cpp.

Referenced by DebugNum().