[Asterisk-code-review] app echo: forward and generate VIDUPDATE frames (asterisk[13])

Jacek Konieczny asteriskteam at digium.com
Fri Mar 25 10:44:18 CDT 2016


Jacek Konieczny has uploaded a new change for review.

  https://gerrit.asterisk.org/2467

Change subject: app_echo: forward and generate VIDUPDATE frames
......................................................................

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

Change-Id: I73bda87bf7532ee8bfb28d917045a21034908c1e
---
M apps/app_echo.c
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/2467/1

diff --git a/apps/app_echo.c b/apps/app_echo.c
index d8b2079..64bb5f5 100644
--- a/apps/app_echo.c
+++ b/apps/app_echo.c
@@ -58,6 +58,7 @@
 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,17 @@
 		}
 		f->delivery.tv_sec = 0;
 		f->delivery.tv_usec = 0;
+		if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_VIDUPDATE
+			&& ast_write(chan, f)) {
+			ast_frfree(f);
+			fir_sent = 1;
+			goto end;
+		}
+		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

-- 
To view, visit https://gerrit.asterisk.org/2467
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73bda87bf7532ee8bfb28d917045a21034908c1e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Jacek Konieczny <jkonieczny at eggsoft.pl>



More information about the asterisk-code-review mailing list