[asterisk-commits] rizzo: branch rizzo/video_v2 r87722 - /team/rizzo/video_v2/utils/testffmpeg.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 30 16:58:07 CDT 2007


Author: rizzo
Date: Tue Oct 30 16:58:07 2007
New Revision: 87722

URL: http://svn.digium.com/view/asterisk?view=rev&rev=87722
Log:
add some code to simulate lost frames.

Modified:
    team/rizzo/video_v2/utils/testffmpeg.c

Modified: team/rizzo/video_v2/utils/testffmpeg.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/utils/testffmpeg.c?view=diff&rev=87722&r1=87721&r2=87722
==============================================================================
--- team/rizzo/video_v2/utils/testffmpeg.c (original)
+++ team/rizzo/video_v2/utils/testffmpeg.c Tue Oct 30 16:58:07 2007
@@ -15,6 +15,8 @@
 #include <stdlib.h>
 #include <memory.h>
 #include <ffmpeg/avcodec.h>
+
+int loss;
 
 static int test(int w, int h, int fmt, int writefd)
 {
@@ -88,6 +90,10 @@
 			continue;
 		if (writefd >= 0)
 			write(writefd, b_enc, i);
+		if (loss && (rand() % 1000) < loss) {
+			fprintf(stderr, " dropping frame %d\n", loop);
+			continue;
+		}
 		x = b_enc;
 		while (i) {
 			int l;
@@ -132,8 +138,11 @@
 
 	avcodec_init();
 	avcodec_register_all();
-	while ((c = getopt(argc, argv, "w:h:o:c:")) != -1) {
+	while ((c = getopt(argc, argv, "w:h:o:c:l:")) != -1) {
 		switch (c) {
+		case 'l':
+			loss = atoi(optarg);
+			break;
 		case 'h':
 			h = atoi(optarg);
 			break;




More information about the asterisk-commits mailing list