[Sumover-dev] [svn commit] r4834 - in vic/branches/cc: cc/tools rtp

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu May 13 18:59:21 BST 2010


Author: soohyunc
Date: Thu May 13 18:59:21 2010
New Revision: 4834

Added:
   vic/branches/cc/cc/i.sh   (contents, props changed)
   vic/branches/cc/cc/tools/xr_send.cc   (contents, props changed)
Modified:
   vic/branches/cc/cc/o.sh
   vic/branches/cc/rtp/session.cpp
   vic/branches/cc/rtp/session.h

Log:
print timestamp and seqno when sending XR (from data receiver)

-- this is to see and debug if the data receiver builds XR as soon as they 
   get RTP data packet from the sender

added a simpe shell script and C++ code to generate necessary trace file.



Added: vic/branches/cc/cc/i.sh
==============================================================================
--- (empty file)
+++ vic/branches/cc/cc/i.sh	Thu May 13 18:59:21 2010
@@ -0,0 +1,9 @@
+#!/bin/sh
+# $Id$
+
+SCALE=100
+
+cat trace.r | grep now | awk '{print $4" "$6" "$8}' > xr_send.tr
+cc/tools/xr_send xr_send xr_send.tr $SCALE
+
+

Modified: vic/branches/cc/cc/o.sh
==============================================================================
--- vic/branches/cc/cc/o.sh	(original)
+++ vic/branches/cc/cc/o.sh	Thu May 13 18:59:21 2010
@@ -1,4 +1,5 @@
 #!/bin/sh
+# $Id$
 
 SCALE=100
 

Added: vic/branches/cc/cc/tools/xr_send.cc
==============================================================================
--- (empty file)
+++ vic/branches/cc/cc/tools/xr_send.cc	Thu May 13 18:59:21 2010
@@ -0,0 +1,86 @@
+/*
+ * Copyright(c) 2010 University College London
+ * All rights reserved.
+ *
+ * AUTHOR: Soo-Hyun Choi <s.choi at cs.ucl.ac.uk>
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name of the University nor of the Laboratory may be used
+ *    to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE
+ *
+ * $Id$
+ */
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <sstream>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+using namespace std;
+
+int main (int argc, char *argv[]) {
+
+	if (argc < 2) {
+	cout << "Usage: ./xr_send <desired output filename> <input file> <dummy>" << endl;
+	exit (0);
+	}
+
+	string option = argv[1]; 
+	ifstream fin (argv[2]);
+	int scale = atoi(argv[3]);
+	ofstream fout;
+
+	// variables
+	string items, stat;
+	double time;
+	double offset;
+	int b, e;  // begin and end of XR fields
+	bool vf = false;  // the very first line
+
+	if (fin.is_open()) {
+		// preparing for the output file
+		stringstream ss;
+		ss << option << ".xg";
+		fout.open(ss.str().c_str());
+
+		// get input file stream
+		while (getline(fin, items)) {
+			istringstream is(items);
+			is >> time >> b >> e;
+			if(!vf) { offset = time; vf = true; }
+			fout << (time-offset) << "\t" 
+			<< b << " " << e << " " << scale << endl;
+		} // while
+
+		fin.close();
+		fout.close();
+	} else {
+			cout << "Unable to open file!: " << argv[1] << endl;
+	}
+
+	return 0;
+}

Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp	(original)
+++ vic/branches/cc/rtp/session.cpp	Thu May 13 18:59:21 2010
@@ -822,8 +822,8 @@
 	xr->begin_seq = htons(begin_seq);
 	xr->end_seq = htons(end_seq);
 
-	fprintf(stderr, "\t>> sending RTCP XR: BT:%d, begin:%d, end:%d\n",
-			bt, ntohs(xr->begin_seq), ntohs(xr->end_seq));
+	//fprintf(stderr, "\t>> sending RTCP XR: BT:%d, begin:%d, end:%d\n",
+	//		bt, ntohs(xr->begin_seq), ntohs(xr->end_seq));
 
 	// declare XR report chunks
 	u_int16_t *xrchunks = (u_int16_t *) (xr + 1);
@@ -858,6 +858,7 @@
 	rh->rh_len = htons((len >> 2) - 1);
 
 	// send XR report block
+	send_xr_info(bt, begin_seq, end_seq);
 	ch->send(pktbuf_, len);
 }
 

Modified: vic/branches/cc/rtp/session.h
==============================================================================
--- vic/branches/cc/rtp/session.h	(original)
+++ vic/branches/cc/rtp/session.h	Thu May 13 18:59:21 2010
@@ -56,7 +56,7 @@
 bool is_sender_ = false;
 
 class DataHandler : public IOHandler {
-    public:
+public:
 	DataHandler* next;
 	inline DataHandler() : next(0), sm_(0), net_(0), addrp_(0) {}
 //	inline DataHandler(SessionManager& sm) : sm_(sm), net_(0), addrp_(0) {}
@@ -76,10 +76,13 @@
 		net_->send(bp, len);
 	}
 	inline void manager(SessionManager* sm) { sm_ = sm; }
-    protected:
+
+protected:
 	SessionManager *sm_;
 	Network* net_;
 	Address *addrp_;
+
+private:
 };
 /*
  * Parameters controling the RTCP report rate timer.
@@ -281,6 +284,10 @@
 	inline void xr_arrival_info(int nbytes, int i) {
 	fprintf(stderr, "  \tnow: %f\tnbytes[%d]: %d\n",tx_get_now(),i,nbytes);
 	}
+	inline void send_xr_info(int bt, u_int16_t b, u_int16_t e){
+	fprintf(stderr, "\tBT: %d\tnow: %f begin: %d end: %d\n",
+	bt, tx_get_now(), b, e);
+	}
 };
 
 class AudioSessionManager : public SessionManager {



More information about the Sumover-dev mailing list