UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
hd_rum_decompress::state_transcoder_decompress Struct Reference
Inheritance diagram for hd_rum_decompress::state_transcoder_decompress:
Inheritance graph
Collaboration diagram for hd_rum_decompress::state_transcoder_decompress:
Collaboration graph

Public Member Functions

virtual ~state_transcoder_decompress ()
 
void frame_arrived (struct video_frame *f, struct audio_frame *a)
 
void worker ()
 
- Public Member Functions inherited from frame_recv_delegate

Public Attributes

struct capture_filter * capture_filter_state
 
struct common_opts common = { COMMON_OPTS_INIT }
 
struct control_state * control
 
struct display * display
 
condition_variable frame_consumed_cv
 
condition_variable have_frame_cv
 
mutex lock
 
std::queue< std::shared_ptr< video_frame > > received_frame
 
thread receiver_thread
 
struct state_recompress * recompress
 
ultragrid_rtp_video_rxtx * video_rxtx
 
thread worker_thread
 

Detailed Description

Definition at line 76 of file hd-rum-decompress.cpp.

Constructor & Destructor Documentation

◆ ~state_transcoder_decompress()

virtual hd_rum_decompress::state_transcoder_decompress::~state_transcoder_decompress ( )
inlinevirtual

Definition at line 94 of file hd-rum-decompress.cpp.

94{}

Member Function Documentation

◆ frame_arrived()

void hd_rum_decompress::state_transcoder_decompress::frame_arrived ( struct video_frame * ,
struct audio_frame *  )
virtual

Implementing method must release both audio and video frame received as parameters with AUDIO_FRAME_DISPOSE() and VIDEO_FRAME_DISPOSE().

Implements frame_recv_delegate.

Definition at line 102 of file hd-rum-decompress.cpp.

103{
105 if (a) {
106 LOG(LOG_LEVEL_WARNING) << "Unexpectedly receiving audio!\n";
108 }
109 auto deleter = vf_free;
110 // apply capture filter
111 if (f) {
113 }
114 if (f && f->callbacks.dispose) {
115 deleter = f->callbacks.dispose;
116 }
117 if (!f) {
118 return;
119 }
120
121 unique_lock<mutex> l(lock);
122 if (received_frame.size() >= MAX_QUEUE_SIZE) {
123 fprintf(stderr, "Hd-rum-decompress max queue size (%d) reached!\n", MAX_QUEUE_SIZE);
124 }
125 frame_consumed_cv.wait(l, [this]{ return received_frame.size() < MAX_QUEUE_SIZE; });
126 received_frame.emplace(f, deleter);
127 l.unlock();
128 have_frame_cv.notify_one();
129}
int void(** deleter)(void *))
void vf_free(struct video_frame *buf)
Frees video_frame structure.
#define AUDIO_FRAME_DISPOSE(frame)
Definition types.h:117
struct video_frame * capture_filter(struct capture_filter *state, struct video_frame *frame)
#define LOG(level)
Definition debug.h:313
#define LOG_LEVEL_WARNING
less severe errors
Definition debug.h:60
#define PROFILE_FUNC
std::queue< std::shared_ptr< video_frame > > received_frame
#define MAX_QUEUE_SIZE

References AUDIO_FRAME_DISPOSE, video_frame::callbacks, capture_filter(), capture_filter_state, deleter, video_frame_callbacks::dispose, frame_consumed_cv, have_frame_cv, LOG, LOG_LEVEL_WARNING, MAX_QUEUE_SIZE, PROFILE_FUNC, received_frame, and vf_free().

Here is the call graph for this function:

◆ worker()

void state_transcoder_decompress::worker ( )

Definition at line 142 of file hd-rum-decompress.cpp.

143{
145 bool should_exit = false;
146 while (!should_exit) {
147 unique_lock<mutex> l(lock);
148 PROFILE_DETAIL("wait for received frame");
149 have_frame_cv.wait(l, [this]{return !received_frame.empty();});
150
151 auto frame = std::move(received_frame.front());
152 l.unlock();
153 PROFILE_DETAIL("");
154
155 if(!frame){
156 should_exit = true;
157 } else {
159 }
160
161 // we are removing from queue now because special messages are "accepted" when queue is empty
162 l.lock();
163 received_frame.pop();
164 l.unlock();
165 frame_consumed_cv.notify_one();
166 }
167}
struct video_frame * frame
void recompress_process_async(state_recompress *s, std::shared_ptr< video_frame > frame)
#define PROFILE_DETAIL(name)

References frame, frame_consumed_cv, have_frame_cv, PROFILE_DETAIL, PROFILE_FUNC, received_frame, recompress, and recompress_process_async().

Referenced by hd_rum_decompress_init().

Here is the call graph for this function:

Member Data Documentation

◆ capture_filter_state

struct capture_filter* hd_rum_decompress::state_transcoder_decompress::capture_filter_state

◆ common

struct common_opts hd_rum_decompress::state_transcoder_decompress::common = { COMMON_OPTS_INIT }

Definition at line 99 of file hd-rum-decompress.cpp.

#define COMMON_OPTS_INIT
Definition host.h:179

Referenced by hd_rum_decompress_init().

◆ control

struct control_state* hd_rum_decompress::state_transcoder_decompress::control

Definition at line 89 of file hd-rum-decompress.cpp.

◆ display

struct display* hd_rum_decompress::state_transcoder_decompress::display

Definition at line 88 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_done(), and hd_rum_decompress_init().

◆ frame_consumed_cv

condition_variable hd_rum_decompress::state_transcoder_decompress::frame_consumed_cv

Definition at line 85 of file hd-rum-decompress.cpp.

Referenced by frame_arrived(), and worker().

◆ have_frame_cv

condition_variable hd_rum_decompress::state_transcoder_decompress::have_frame_cv

Definition at line 84 of file hd-rum-decompress.cpp.

Referenced by frame_arrived(), hd_rum_decompress_done(), and worker().

◆ lock

mutex hd_rum_decompress::state_transcoder_decompress::lock

Definition at line 83 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_done().

◆ received_frame

std::queue<std::shared_ptr<video_frame> > hd_rum_decompress::state_transcoder_decompress::received_frame

Definition at line 81 of file hd-rum-decompress.cpp.

Referenced by frame_arrived(), hd_rum_decompress_done(), and worker().

◆ receiver_thread

thread hd_rum_decompress::state_transcoder_decompress::receiver_thread

Definition at line 90 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_done(), and hd_rum_decompress_init().

◆ recompress

struct state_recompress* hd_rum_decompress::state_transcoder_decompress::recompress

Definition at line 79 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_init(), and worker().

◆ video_rxtx

ultragrid_rtp_video_rxtx* hd_rum_decompress::state_transcoder_decompress::video_rxtx

Definition at line 77 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_done(), and hd_rum_decompress_init().

◆ worker_thread

thread hd_rum_decompress::state_transcoder_decompress::worker_thread

Definition at line 86 of file hd-rum-decompress.cpp.

Referenced by hd_rum_decompress_done(), and hd_rum_decompress_init().


The documentation for this struct was generated from the following file: