diff options
author | Jacek Konieczny <jkonieczny@eggsoft.pl> | 2016-03-25 16:42:12 +0100 |
---|---|---|
committer | Jacek Konieczny <jkonieczny@eggsoft.pl> | 2016-03-29 11:20:17 +0200 |
commit | 6a9c18fb5933bff08c66e3c3d6c5435da59b0040 (patch) | |
tree | 6d1745241bcf1c259dc1f3bbbf93a985041d2a2d /apps | |
parent | 36d016b1abb6707bfde821ac2407933a447f3d13 (diff) |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_echo.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/app_echo.c b/apps/app_echo.c index d8b207967..c6e37db57 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -58,6 +58,7 @@ static const char app[] = "Echo"; static int echo_exec(struct ast_channel *chan, const char *data) { int res = -1; + int fir_sent = 0; while (ast_waitfor(chan, -1) > -1) { struct ast_frame *f = ast_read(chan); @@ -66,6 +67,22 @@ static int echo_exec(struct ast_channel *chan, const char *data) } f->delivery.tv_sec = 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 && f->frametype != AST_FRAME_MODEM && f->frametype != AST_FRAME_NULL |