Skip to content
Snippets Groups Projects
Commit 9785e8d0 authored by Jacek Konieczny's avatar Jacek Konieczny Committed by Joshua Colp
Browse files

app_echo: forward and generate VIDUPDATE frames

When using app_echo via WebRTC with VP8 video the video would appear
only after a few minutes, because there would be nothing to request
a full reference frame.

This fixes the problem in both ways:
- echos any VIDUPDATE frames received on the channel
- sends one such frame when first video frame is to be forwarded

This makes the echo work with Firefox and Chrome WebRTC implementation.

ASTERISK-25867 #close

Change-Id: I73bda87bf7532ee8bfb28d917045a21034908c1e
parent 6ce25bd6
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ static const char app[] = "Echo"; ...@@ -58,6 +58,7 @@ static const char app[] = "Echo";
static int echo_exec(struct ast_channel *chan, const char *data) static int echo_exec(struct ast_channel *chan, const char *data)
{ {
int res = -1; int res = -1;
int fir_sent = 0;
while (ast_waitfor(chan, -1) > -1) { while (ast_waitfor(chan, -1) > -1) {
struct ast_frame *f = ast_read(chan); struct ast_frame *f = ast_read(chan);
...@@ -66,6 +67,22 @@ static int echo_exec(struct ast_channel *chan, const char *data) ...@@ -66,6 +67,22 @@ static int echo_exec(struct ast_channel *chan, const char *data)
} }
f->delivery.tv_sec = 0; f->delivery.tv_sec = 0;
f->delivery.tv_usec = 0; f->delivery.tv_usec = 0;
if (f->frametype == AST_FRAME_CONTROL
&& f->subclass.integer == AST_CONTROL_VIDUPDATE) {
if (ast_write(chan, f) < 0) {
ast_frfree(f);
goto end;
}
fir_sent = 1;
}
if (!fir_sent && f->frametype == AST_FRAME_VIDEO) {
struct ast_frame frame = {
.frametype = AST_FRAME_CONTROL,
.subclass.integer = AST_CONTROL_VIDUPDATE,
};
ast_write(chan, &frame);
fir_sent = 1;
}
if (f->frametype != AST_FRAME_CONTROL if (f->frametype != AST_FRAME_CONTROL
&& f->frametype != AST_FRAME_MODEM && f->frametype != AST_FRAME_MODEM
&& f->frametype != AST_FRAME_NULL && f->frametype != AST_FRAME_NULL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment