[Asterisk-code-review] core: Reduce video update queueing. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Sat Aug 26 18:49:55 CDT 2017


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/6319


Change subject: core: Reduce video update queueing.
......................................................................

core: Reduce video update queueing.

A video update frame is used to indicate that a channel
with video negotiated should provide a full frame so the
decoder decoding the stream is able to do so. In situations
where a queue is used to store frames it makes no sense
for the queue to contain multiple video update frames. One
is sufficient to have a full frame be sent.

ASTERISK-27222

Change-Id: Id3f40a6f51b740ae4704003a1800185c0c658ee7
---
M main/autoservice.c
M main/channel.c
M main/core_unreal.c
3 files changed, 15 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/19/6319/1

diff --git a/main/autoservice.c b/main/autoservice.c
index d1a0156..cd7388b 100644
--- a/main/autoservice.c
+++ b/main/autoservice.c
@@ -58,6 +58,7 @@
 	 *  it gets stopped for the last time. */
 	unsigned int use_count;
 	unsigned int orig_end_dtmf_flag:1;
+	unsigned int video_update:1;
 	unsigned int ignore_frame_types;
 	/*! Frames go on at the head of deferred_frames, so we have the frames
 	 *  from newest to oldest.  As we put them at the head of the readq, we'll
@@ -161,6 +162,17 @@
 					AST_LIST_INSERT_HEAD(&ents[i]->deferred_frames, dup_f, frame_list);
 				}
 			} else {
+				if (defer_frame->frametype == AST_FRAME_CONTROL &&
+					defer_frame->subclass.integer == AST_CONTROL_VIDUPDATE) {
+
+					/* If a video update is already queued don't needlessly queue another */
+					if (ents[i]->video_update) {
+						ast_frfree(defer_frame);
+						break;
+					}
+
+					ents[i]->video_update = 1;
+				}
 				if ((dup_f = ast_frisolate(defer_frame))) {
 					AST_LIST_INSERT_HEAD(&ents[i]->deferred_frames, dup_f, frame_list);
 				}
diff --git a/main/channel.c b/main/channel.c
index 74de9ca..8294812 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1097,6 +1097,7 @@
 			}
 			/* Fall through */
 		case AST_CONTROL_HANGUP:
+		case AST_CONTROL_VIDUPDATE:
 			/* Don't queue anything. */
 			ast_channel_unlock(chan);
 			return 0;
diff --git a/main/core_unreal.c b/main/core_unreal.c
index 3db6a4d..763be4f 100644
--- a/main/core_unreal.c
+++ b/main/core_unreal.c
@@ -330,7 +330,8 @@
 		if (!ast_channel_get_default_stream(ast, AST_MEDIA_TYPE_AUDIO)) {
 			return 0;
 		}
-	} else if (f->frametype == AST_FRAME_VIDEO) {
+	} else if (f->frametype == AST_FRAME_VIDEO ||
+		(f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_VIDUPDATE)) {
 		if (!ast_channel_get_default_stream(ast, AST_MEDIA_TYPE_VIDEO)) {
 			return 0;
 		}

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3f40a6f51b740ae4704003a1800185c0c658ee7
Gerrit-Change-Number: 6319
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170826/0d4d18d5/attachment.html>


More information about the asterisk-code-review mailing list