summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-01-27 07:04:52 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-01-27 07:04:52 -0600
commit6f645a6d4e508ad6960fbb9825d4d26694b8087c (patch)
tree1500e4c70a785800c8f6ae90b30f2da4d0ff26ac /main
parent08bc42201d9b3d9f9c402d2dc9ae3c3de961ff89 (diff)
parent1061539b75811d9115dcbc0be46967515bd9e2d1 (diff)
Merge "media: Add experimental support for RTCP feedback."
Diffstat (limited to 'main')
-rw-r--r--main/channel.c10
-rw-r--r--main/frame.c8
-rw-r--r--main/translate.c11
3 files changed, 29 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index d916b7c05..6e88a2906 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1531,6 +1531,7 @@ int ast_is_deferrable_frame(const struct ast_frame *frame)
case AST_FRAME_IAX:
case AST_FRAME_CNG:
case AST_FRAME_MODEM:
+ case AST_FRAME_RTCP:
return 0;
}
return 0;
@@ -2866,6 +2867,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
case AST_FRAME_IMAGE:
case AST_FRAME_HTML:
case AST_FRAME_MODEM:
+ case AST_FRAME_RTCP:
done = 1;
break;
case AST_FRAME_CONTROL:
@@ -4355,6 +4357,14 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
*/
ast_read_generator_actions(chan, f);
break;
+ case AST_FRAME_RTCP:
+ /* Incoming RTCP feedback needs to get to the translator for
+ * outgoing media, which means we treat it as an ast_write */
+ if (ast_channel_writetrans(chan)) {
+ ast_translate(ast_channel_writetrans(chan), f, 0);
+ }
+ ast_frfree(f);
+ f = &ast_null_frame;
default:
/* Just pass it on! */
break;
diff --git a/main/frame.c b/main/frame.c
index 133928bb9..c284a8e1c 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -550,6 +550,8 @@ void ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, ch
break;
}
break;
+ case AST_FRAME_RTCP:
+ ast_copy_string(subclass, "RTCP", slen);
default:
ast_copy_string(subclass, "Unknown Subclass", slen);
break;
@@ -601,6 +603,9 @@ void ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len)
case AST_FRAME_VIDEO:
ast_copy_string(ftype, "Video", len);
break;
+ case AST_FRAME_RTCP:
+ ast_copy_string(ftype, "RTCP", len);
+ break;
default:
snprintf(ftype, len, "Unknown Frametype '%u'", frame_type);
break;
@@ -638,6 +643,9 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
if (f->frametype == AST_FRAME_VIDEO) {
return;
}
+ if (f->frametype == AST_FRAME_RTCP) {
+ return;
+ }
ast_frame_type2str(f->frametype, ftype, sizeof(ftype));
ast_frame_subclass2str(f, subclass, sizeof(subclass), moreinfo, sizeof(moreinfo));
diff --git a/main/translate.c b/main/translate.c
index fa606e71b..168a72a4b 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -530,6 +530,17 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f,
long len;
int seqno;
+ if (f->frametype == AST_FRAME_RTCP) {
+ /* Just pass the feedback to the right callback, if it exists.
+ * This "translation" does nothing so return a null frame. */
+ struct ast_trans_pvt *tp;
+ for (tp = p; tp; tp = tp->next) {
+ if (tp->t->feedback)
+ tp->t->feedback(tp, f);
+ }
+ return &ast_null_frame;
+ }
+
has_timing_info = ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO);
ts = f->ts;
len = f->len;