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 (VideoFrame *Frame, vector< AVBufferRef * > &Discards)
 Store AVBufferRef's for later disposal. More...
 
static void DoDiscard (vector< AVBufferRef * > &Discards)
 
static unsigned long long to_bitmap (const frame_queue_t &Queue, int Num)
 
static int DebugNum (const VideoFrame *Frame)
 
const QString & DebugString (const VideoFrame *Frame, bool Short)
 
const QString & DebugString (uint FrameNum, bool Short)
 

Variables

int next_dbg_str = 0
 
QString dbg_str_arr [DBG_STR_ARR_SIZE]
 
QString dbg_str_arr_short [DBG_STR_ARR_SIZE]
 
map< const VideoFrame *, 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 1172 of file videobuffers.cpp.

Function Documentation

◆ ReleaseDecoderResources()

static void ReleaseDecoderResources ( VideoFrame Frame,
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 ( vector< AVBufferRef * > &  Discards)
inlinestatic

◆ to_bitmap()

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

Definition at line 1217 of file videobuffers.cpp.

Referenced by VideoBuffers::GetStatus().

◆ DebugNum()

static int DebugNum ( const VideoFrame Frame)
static

Definition at line 1197 of file videobuffers.cpp.

Referenced by DebugString(), and to_bitmap().

◆ DebugString() [1/2]

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

◆ DebugString() [2/2]

const QString& DebugString ( uint  FrameNum,
bool  Short 
)

Definition at line 1212 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(), and VideoBuffers::DeleteBuffers().

◆ dbg_str_arr

QString dbg_str_arr[DBG_STR_ARR_SIZE]
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 1173 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str_arr_short

QString dbg_str_arr_short[DBG_STR_ARR_SIZE]
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 1186 of file videobuffers.cpp.

Referenced by DebugString().

◆ dbg_str

map<const VideoFrame *, int> dbg_str

Definition at line 1195 of file videobuffers.cpp.

Referenced by DebugNum().