mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 03:40:30 +00:00
Hd-rum-translator: decompress only if transcoding
The rationale is that hd-rum-translator can be used as a packet reflector as well, in which case it is capable process also different packet types than video. In this case, if we do not require transcoding ports, just disable additional video processing. This has also advantage for video, if we use only packet reflector - no video decompression is done and thus it reduces resourcees usage.
This commit is contained in:
@@ -264,3 +264,17 @@ void hd_rum_decompress_append_port(void *state, void *recompress_state)
|
||||
s->frame_consumed_cv.wait(l, [s]{ return s->received_frame.size() == 0; });
|
||||
}
|
||||
|
||||
int hd_rum_decompress_get_num_active_ports(void *state)
|
||||
{
|
||||
struct state_transcoder_decompress *s = (struct state_transcoder_decompress *) state;
|
||||
|
||||
int ret = 0;
|
||||
for (auto && port : s->output_ports) {
|
||||
if (port.active) {
|
||||
ret += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ void hd_rum_decompress_done(void *state);
|
||||
void hd_rum_decompress_set_active(void *decompress_state, void *recompress_state, bool active);
|
||||
void hd_rum_decompress_remove_port(void *decompress_state, int index);
|
||||
void hd_rum_decompress_append_port(void *decompress_state, void *recompress_state);
|
||||
int hd_rum_decompress_get_num_active_ports(void *decompress_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -326,9 +326,11 @@ static void *writer(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t ret = hd_rum_decompress_write(s->decompress, s->qhead->buf, s->qhead->size);
|
||||
if (ret < 0) {
|
||||
perror("hd_rum_decompress_write");
|
||||
if (hd_rum_decompress_get_num_active_ports(s->decompress) > 0) {
|
||||
ssize_t ret = hd_rum_decompress_write(s->decompress, s->qhead->buf, s->qhead->size);
|
||||
if (ret < 0) {
|
||||
perror("hd_rum_decompress_write");
|
||||
}
|
||||
}
|
||||
|
||||
s->qhead = s->qhead->next;
|
||||
|
||||
Reference in New Issue
Block a user