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

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


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3899

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/99/3899/1

diff --git a/main/codec_builtin.c b/main/codec_builtin.c
index facb5a8..0371bc9 100644
--- a/main/codec_builtin.c
+++ b/main/codec_builtin.c
@@ -758,24 +758,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 a8d4a90..d6eea3c 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4763,6 +4763,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/3899
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list