[Asterisk-code-review] rtp: Preserve timestamps on video frames. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Sep 14 08:17:18 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3898

Change subject: rtp: Preserve timestamps on video frames.
......................................................................

rtp: Preserve timestamps on video frames.

Currently when receiving video over RTP we store only
a calculated samples on the frame. When starting the video
it can take some time for this calculation to actually yield
a value as it requires constant changing timestamps. As well
if a video frame passes over multiple RTP packets this calculation
will fail as the timestamp is the same as the previous RTP
packet and the number of samples calculated will be 0.

This change preserves the timestamp on the frame and allows
it to pass through the core. When sending the video this timestamp
is used instead of a new one being calculated.

ASTERISK-26367 #close

Change-Id: Iba8179fb5c14c9443aee4baf670d2185da3ecfbd
---
M main/codec_builtin.c
M res/res_rtp_asterisk.c
2 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/98/3898/1

diff --git a/main/codec_builtin.c b/main/codec_builtin.c
index 1d329bc..7689dd9 100644
--- a/main/codec_builtin.c
+++ b/main/codec_builtin.c
@@ -728,24 +728,28 @@
 	.name = "h261",
 	.description = "H.261 video",
 	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
 };
 
 static struct ast_codec h263 = {
 	.name = "h263",
 	.description = "H.263 video",
 	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
 };
 
 static struct ast_codec h263p = {
 	.name = "h263p",
 	.description = "H.263+ video",
 	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
 };
 
 static struct ast_codec h264 = {
 	.name = "h264",
 	.description = "H.264 video",
 	.type = AST_MEDIA_TYPE_VIDEO,
+	.sample_rate = 1000,
 };
 
 static struct ast_codec mpeg4 = {
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index d05774f..627f800 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4764,6 +4764,8 @@
 		/* Video -- samples is # of samples vs. 90000 */
 		if (!rtp->lastividtimestamp)
 			rtp->lastividtimestamp = timestamp;
+		ast_set_flag(&rtp->f, AST_FRFLAG_HAS_TIMING_INFO);
+		rtp->f.ts = timestamp / (rtp_get_rate(rtp->f.subclass.format) / 1000);
 		rtp->f.samples = timestamp - rtp->lastividtimestamp;
 		rtp->lastividtimestamp = timestamp;
 		rtp->f.delivery.tv_sec = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba8179fb5c14c9443aee4baf670d2185da3ecfbd
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list