diff --git a/CMakeLists.txt b/CMakeLists.txt index b60cc6e..d0f0e42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,4 +75,4 @@ INCLUDE_DIRECTORIES( ${scream_SOURCE_DIR}/../include ) -ADD_SUBDIRECTORY( code) +ADD_SUBDIRECTORY( code) diff --git a/README.md b/README.md index 011c695..1b2cad9 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ This project includes an implementation of SCReAM, a mobile optimised congestion control algorithm for realtime interactive media. ## Algorithm -SCReAM (**S**elf-**C**locked **R**at**e** **A**daptation for **M**ultimedia) is a congestion control algorithm devised mainly for Video. -Congestion control for WebRTC media is currently being standardized in the IETF RMCAT WG, the scope of the working group is to define requirements for congestion control and also to standardize a few candidate solutions. -SCReAM is a congestion control candidate solution for WebRTC developed at Ericsson Research and optimized for good performance in wireless access. +SCReAM (**S**elf-**C**locked **R**at**e** **A**daptation for **M**ultimedia) is a congestion control algorithm devised mainly for Video. +Congestion control for WebRTC media is currently being standardized in the IETF RMCAT WG, the scope of the working group is to define requirements for congestion control and also to standardize a few candidate solutions. +SCReAM is a congestion control candidate solution for WebRTC developed at Ericsson Research and optimized for good performance in wireless access. The algorithm is an IETF experimental standard [1], a Sigcomm paper [2] and [3] explains the rationale behind the design of the algorithm in more detail. A comparison against GCC (Google Congestion Control) is shown in [4]. Final presentations are found in [5] and [6]. A short [video](https://www.youtube.com/watch?v=_jBFu-Y0wwo) exemplifies the use of SCReAM in a small vehicle, remote controlled over a public LTE network. [7] explains the rationale behind the use of SCReAM in remote controlled applications over LTE/5G. Unlike many other congestion control algorithms that are rate based i.e. they estimate the network throughput and adjust the media bitrate accordingly, SCReAM is self-clocked which essentially means that the algorithm does not send in more data into a network than what actually exits the network. -To achieve this, SCReAM implements a feedback protocol over RTCP that acknowledges received RTP packets. -A congestion window is determined from the feedback, this congestion window determines how many RTP packets that can be in flight i.e. transmitted by not yet acknowledged, an RTP queue is maintained at the sender side to temporarily store the RTP packets pending transmission, this RTP queue is mostly empty but can temporarily become larger when the link throughput decreases. -The congestion window is frequently adjusted for minimal e2e delay while still maintaining as high link utilization as possible. The use of self-clocking in SCReAM which is also the main principle in TCP has proven to work particularly well in wireless scenarios where the link throughput may change rapidly. This enables a congestion control which is robust to channel jitter, introduced by e.g. radio resource scheduling while still being able to respond promptly to reduced link throughput. +To achieve this, SCReAM implements a feedback protocol over RTCP that acknowledges received RTP packets. +A congestion window is determined from the feedback, this congestion window determines how many RTP packets that can be in flight i.e. transmitted by not yet acknowledged, an RTP queue is maintained at the sender side to temporarily store the RTP packets pending transmission, this RTP queue is mostly empty but can temporarily become larger when the link throughput decreases. +The congestion window is frequently adjusted for minimal e2e delay while still maintaining as high link utilization as possible. The use of self-clocking in SCReAM which is also the main principle in TCP has proven to work particularly well in wireless scenarios where the link throughput may change rapidly. This enables a congestion control which is robust to channel jitter, introduced by e.g. radio resource scheduling while still being able to respond promptly to reduced link throughput. SCReAM is optimized in house in a state of the art LTE system simulator for optimal performance in deployments where the LTE radio conditions are limiting. In addition, SCReAM is also optimized for good performance in simple bottleneck case such as those given in home gateway deployments. SCReAM is verified in simulator and in a testbed to operate in a rate range from ~20kbps up to 100Mbps. The fact that SCReAM maintains a RTP queue on the sender side opens up for further optimizations to congestion, for instance it is possible to discard the contents of the RTP queue and replace with an I frame in order to refresh the video quickly at congestion. @@ -22,14 +22,14 @@ Below is shown an example of SCReAM congestion control when subject to a bottlen Figure 1 : Simple bottleneck simulation SCReAM -## ECN (Explicit Congestion Notification) -SCReAM supports "classic" ECN, i.e. that the sending rate is reduced as a result of one or more ECN marked RTP packets in one RTT, similar to the guidelines in RFC3168. . +## ECN (Explicit Congestion Notification) +SCReAM supports "classic" ECN, i.e. that the sending rate is reduced as a result of one or more ECN marked RTP packets in one RTT, similar to the guidelines in RFC3168. . -In addition SCReAM also supports L4S, i.e that the sending rate is reduced proportional to the fraction of the RTP packets that are ECN marked. This enables lower network queue delay. +In addition SCReAM also supports L4S, i.e that the sending rate is reduced proportional to the fraction of the RTP packets that are ECN marked. This enables lower network queue delay. Below is shown three simulation examples with a simple 50Mbps bottleneck that changes to 25Mbps after 50s, the min RTT is 20ms. The video trace is from NVENC. -The graphs show that ECN improves on the e2e delay and that the use of L4S reduces the delay considerably more. +The graphs show that ECN improves on the e2e delay and that the use of L4S reduces the delay considerably more. L4S gives a somewhat lower media rate, the reason is that a larger headroom is added to ensure the low delay, considering the varying output rate of the video encoder. This is self-adjusting by inherent design, the average bitrate would increase if the frame size variations are smaller. @@ -38,10 +38,10 @@ Note carefully that the scales in the graphs differ, especially the delay graph ![Simple bottleneck simulation SCReAM no ECN support](https://github.com/EricssonResearch/scream/blob/master/images/scream_noecn_2.png) Figure 2 : SCReAM without ECN support - + ![Simple bottleneck simulation SCReAM with ECN support](https://github.com/EricssonResearch/scream/blob/master/images/scream_ecn_2.png) -Figure 3 : SCReAM with ECN support ECN beta = 0.8. CoDel with default settings (5ms, 100ms) +Figure 3 : SCReAM with ECN support ECN beta = 0.8. CoDel with default settings (5ms, 100ms) ![Simple bottleneck simulation SCReAM with L4S support](https://github.com/EricssonResearch/scream/blob/master/images/scream_l4s_2.png) @@ -51,9 +51,9 @@ Figure 4 : SCReAM with L4S support. L4S ramp-marker (Th_low=2ms, Th_high=10ms) The two videos below show a simple test with a simple 3Mbps bottleneck (CoDel AQM, ECN cabable). The first video is with ECN disabled in the sender, the other is with ECN enabled. SCReAM is here used with a Panasonic WV-SBV111M IP camera. One may argue that one can disable CoDel to avoid the packet losses, unfortunately one then lose the positive properties with CoDel, mentioned earlier. -[Without ECN](https://www.youtube.com/watch?v=J0po78q1QkU "Without ECN") +[Without ECN](https://www.youtube.com/watch?v=J0po78q1QkU "Without ECN") -[With ECN](https://www.youtube.com/watch?v=qIe0ubw9jPw "With ECN") +[With ECN](https://www.youtube.com/watch?v=qIe0ubw9jPw "With ECN") The green areas that uccur due to packet loss is an artifact in the conversion of the RTP dump. ## Real life test @@ -62,17 +62,17 @@ A real life test of SCReAM is performed with the following setup in a car: - Sony Camcorder placed on dashboard, HDMI output used - Antrica ANT-35000A video encoder with 1000-8000kbps encoding range and 1080p50 mode - Laptop with a SCReAM sender running -- Sony Xperia phone in WiFi tethering mode +- Sony Xperia phone in WiFi tethering mode A SCReAM receiver that logged the performance and stored the received RTP packets was running in an office. The video traffic was thus transmitted in LTE uplink.The video was played out to file with GStreamer, the jitter buffer was disabled to allow for the visibility of the delay jitter artifacts, -Below is a graph that shows the bitrate, the congestion window and the queue delay. +Below is a graph that shows the bitrate, the congestion window and the queue delay. ![Log from ](https://github.com/EricssonResearch/scream/blob/master/images/SCReAM_LTE_UL.png) Figure 5 : Trace from live drive test -The graph shows that SCReAM manages high bitrate video streaming with low e2e delay despite demanding conditions both in terms of variable throughput and in a changing output bitrate from the video encoder. Packet losses occur relatively frequently, the exact reason is unknown but seem to be related to handover events, normally packet loss should not occure in LTE-UL, however this seems to be the case with the used cellphone. +The graph shows that SCReAM manages high bitrate video streaming with low e2e delay despite demanding conditions both in terms of variable throughput and in a changing output bitrate from the video encoder. Packet losses occur relatively frequently, the exact reason is unknown but seem to be related to handover events, normally packet loss should not occure in LTE-UL, however this seems to be the case with the used cellphone. The delay increases between 1730 and 1800s, the reason here is that the available throughput was lower than the lowest possible coder bitrate. An encoder with a wider rate range would be able to make it possible to keep the delay low also in this case. A video from the experiment is found at the link below. The artifacts and overall video quality can be correlated aginst the graph above. @@ -104,17 +104,17 @@ A few support classes for experimental use are implemented in: - NetQueue : Simple delay and bandwidth limitation -For more information on how to use the code in multimedia clients or in experimental platforms, please see [https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx](https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx?raw=true) +For more information on how to use the code in multimedia clients or in experimental platforms, please see [https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx](https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx?raw=true) ## References [1] https://tools.ietf.org/html/rfc8298 -[2] Sigcomm paper http://dl.acm.org/citation.cfm?id=2631976 +[2] Sigcomm paper http://dl.acm.org/citation.cfm?id=2631976 [3] Sigcomm presentation http://conferences.sigcomm.org/sigcomm/2014/doc/slides/150.pdf -[4] IETF RMCAT presentation, comparison against Google Congestion Control (GCC) http://www.ietf.org/proceedings/90/slides/slides-90-rmcat-3.pdf +[4] IETF RMCAT presentation, comparison against Google Congestion Control (GCC) http://www.ietf.org/proceedings/90/slides/slides-90-rmcat-3.pdf [5] IETF RMCAT presentation (final for WGLC) : https://www.ietf.org/proceedings/96/slides/slides-96-rmcat-0.pdf @@ -138,20 +138,54 @@ The feedback overhead depends on the media bitrate. The table below shows the IP | 30000 | 500 | +-----------------------------------------------------+ -## Build +# How to build this repository? + +We assume you have git already installed, since you checked this out. + The SCReAM code comes in two (three) applications -- Windows based test application : This application implements a simple bottleneck and does only local simulation. Open the scream.sln application in Visual studio and build. -- Linux based BW test application : Makes in possible to benchmark the throughput live networks and test beds. The tool models a video encoder. See https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx for further instructions. -- gstreamer plugin : This application is kept in ./code/gscream . It is however currently not maintained and may not work properly +- Windows-based test application: This application implements a simple bottleneck and does only local simulation. Open the scream.sln application in Visual studio and build. +- Linux-based bandwidth test application: Makes in possible to benchmark the throughput live networks and test beds. The tool models a video encoder. See https://github.com/EricssonResearch/scream/blob/master/SCReAM-description.pptx for further instructions. +- gstreamer plugin: This application is kept in ./code/gscream . It is however currently not maintained and may not work properly + +## BW test tool + +To build the bandwidth test application (this has been tested on Debian buster and Ubuntu 16.04 and later), install some generic build dependencies first: + + sudo apt-get install autoconf autopoint bison build-essential cmake flex gettext libtool pkg-config yasm + + cmake . && make + +creates `bin/scream_bw_test_rx` +and `bin/scream_bw_test_tx` + +## gscream + +### install dependencies + + sudo apt-get install gstreamer1.0-{doc,libav,tools,x,plugins-{base,good,bad,ugly}} + sudo apt-get install libglib2.0-dev liborc-0.4-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + +### build plugins + + cd code/gscream/gst-gscreamrx/gst-plugin + ./autogen.sh && make + cd rx tx + ./autogen.sh && make + cd ../../../.. + +creates `code/gscream/gst-gscreamrx/gst-plugin/src/.libs/libgstgscreamrx.so` +and `code/gscream/gst-gscreamtx/gst-plugin/src/.libs/libgstgscreamtx.so` +which, with a `sudo make install` in the respective directories, will be +installed into `/usr/local/lib/gstreamer-1.0/`. -### Build SCReAM BW test application +### build test applications -The SCReAM BW test application runs on e.g Ubuntu 16.04 and later. The build steps are: + cd code/gscream + make -``` -cmake . -make -``` +creates `code/gscream/gscream_app_rpi_tx`, +`code/gscream/gscream_app_rx` and `code/gscream/gscream_app_tx` -You need git, cmake, make and g++ installed \ No newline at end of file +See [`code/gscream/readme.txt`](./code/gscream/readme.txt) for +what to do with these files. diff --git a/Sierra-RV50X-logger.py b/Sierra-RV50X-logger.py index 4dce2bc..ce21623 100644 --- a/Sierra-RV50X-logger.py +++ b/Sierra-RV50X-logger.py @@ -1,4 +1,3 @@ - import requests import json import datetime @@ -81,12 +80,12 @@ def send_to_udp_socket(result): UDP_IP = "127.0.0.1" UDP_PORT = 35000 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - sock.sendto(bytes(result, 'utf-8'), (UDP_IP, UDP_PORT)) + sock.sendto(bytes(result, 'utf-8'), (UDP_IP, UDP_PORT)) # params = ['Cellular IP Address', 'ESN/EID/IMEI'] params = param_ids.keys() try: - while True: + while True: result = make_request(params) #result = make_request(payload) #print('result:', json.dumps(result, indent=4)) diff --git a/code/NetQueue.cpp b/code/NetQueue.cpp index 4c9b298..fa00d27 100644 --- a/code/NetQueue.cpp +++ b/code/NetQueue.cpp @@ -6,6 +6,7 @@ #include using namespace std; + /* * Implements a simple RTP packet queue */ @@ -40,10 +41,10 @@ NetQueue::NetQueue(float delay_, float rate_, float jitter_, bool isL4s_) { tQueueAvg = 0.0; } -void NetQueue::insert(float time, - void *rtpPacket, +void NetQueue::insert(float time, + void *rtpPacket, unsigned int ssrc, - int size, + int size, unsigned short seqNr, bool isCe) { head++; if (head == NetQueueSize) head = 0; @@ -63,10 +64,10 @@ void NetQueue::insert(float time, nextTx = items[head]->tRelease; } -bool NetQueue::extract(float time, - void *rtpPacket, +bool NetQueue::extract(float time, + void *rtpPacket, unsigned int &ssrc, - int& size, + int& size, unsigned short& seqNr, bool& isCe) { if (items[tail]->used == false) { @@ -116,7 +117,7 @@ bool NetQueue::extract(float time, int NetQueue::sizeOfQueue() { int size = 0; for (int n=0; n < NetQueueSize; n++) { - if (items[n]->used) + if (items[n]->used) size += items[n]->size; } return size; diff --git a/code/NetQueue.h b/code/NetQueue.h index 2247a06..a435ad2 100644 --- a/code/NetQueue.h +++ b/code/NetQueue.h @@ -1,7 +1,6 @@ #ifndef NET_QUEUE #define NET_QUEUE - class NetQueueItem { public: NetQueueItem(); @@ -26,10 +25,10 @@ class NetQueue { int size, unsigned short seqNr, bool isCe = false); - bool extract(float time, - void *rtpPacket, + bool extract(float time, + void *rtpPacket, unsigned int &ssrc, - int& size, + int& size, unsigned short &seqNr, bool &isCe); int sizeOfQueue(); @@ -54,4 +53,4 @@ class NetQueue { float tQueueAvg; }; -#endif \ No newline at end of file +#endif diff --git a/code/RtpQueue.cpp b/code/RtpQueue.cpp index 0b1e044..87d6794 100644 --- a/code/RtpQueue.cpp +++ b/code/RtpQueue.cpp @@ -1,4 +1,4 @@ - #include "RtpQueue.h" +#include "RtpQueue.h" #include #include using namespace std; @@ -48,21 +48,59 @@ void RtpQueue::push(void *rtpPacket, int size, unsigned short seqNr, float ts) { bool RtpQueue::pop(void *rtpPacket, int& size, unsigned short& seqNr) { if (items[tail]->used == false) { - return false; sizeOfNextRtp_ = -1; + return false; } else { size = items[tail]->size; memcpy(rtpPacket,items[tail]->packet,size); seqNr = items[tail]->seqNr; items[tail]->used = false; - tail++; if (tail == kRtpQueueSize) tail = 0; bytesInQueue_ -= size; sizeOfQueue_ -= 1; + tail++; if (tail == kRtpQueueSize) tail = 0; computeSizeOfNextRtp(); return true; } } +#ifdef GSCREAM +void RtpQueue::push(GstBuffer *buffer, int size, unsigned short seqNr, float ts) { + int ix = head+1; + if (ix == kRtpQueueSize) ix = 0; + if (items[ix]->used) { + /* + * RTP queue is full, do a drop tail i.e ignore new RTP packets + */ + return; + } + head = ix; + items[head]->seqNr = seqNr; + items[head]->size = size; + items[head]->ts = ts; + items[head]->used = true; + items[head]->buffer = buffer; + bytesInQueue_ += size; + sizeOfQueue_ += 1; + computeSizeOfNextRtp(); +} + +GstBuffer* RtpQueue::pop(unsigned short& seqNr) { + if (items[tail]->used == false) { + sizeOfNextRtp_ = -1; + return 0; + } else { + GstBuffer *buffer = items[tail]->buffer; + seqNr = items[tail]->seqNr; + items[tail]->used = false; + bytesInQueue_ -= items[tail]->size; + sizeOfQueue_ -= 1; + tail++; if (tail == kRtpQueueSize) tail = 0; + computeSizeOfNextRtp(); + return buffer; + } +} +#endif + void RtpQueue::computeSizeOfNextRtp() { if (!items[tail]->used) { sizeOfNextRtp_ = - 1; diff --git a/code/RtpQueue.h b/code/RtpQueue.h index 175d175..a663aee 100644 --- a/code/RtpQueue.h +++ b/code/RtpQueue.h @@ -1,10 +1,14 @@ #ifndef RTP_QUEUE #define RTP_QUEUE +#ifdef GSCREAM +#include +#endif + /* -* Implements a simple RTP packet queue, one RTP queue -* per stream {SSRC,PT} -*/ + * Implements a simple RTP packet queue, one RTP queue + * per stream {SSRC,PT} + */ class RtpQueueIface { public: @@ -25,6 +29,9 @@ class RtpQueueItem { unsigned short seqNr; float ts; bool used; +#ifdef GSCREAM + GstBuffer *buffer; +#endif }; const int kRtpQueueSize = 1024; @@ -34,6 +41,10 @@ class RtpQueue : public RtpQueueIface { void push(void *rtpPacket, int size, unsigned short seqNr, float ts); bool pop(void *rtpPacket, int &size, unsigned short &seqNr); +#ifdef GSCREAM + void push(GstBuffer *buf, int size, unsigned short seqNr, float ts); + GstBuffer* pop(unsigned short &seqNr); +#endif int sizeOfNextRtp(); int seqNrOfNextRtp(); int bytesInQueue(); // Number of bytes in queue @@ -41,15 +52,15 @@ class RtpQueue : public RtpQueueIface { float getDelay(float currTs); bool sendPacket(void *rtpPacket, int &size, unsigned short &seqNr); void clear(); + void setSizeOfLastFrame(int sz) { sizeOfLastFrame = sz; }; int getSizeOfLastFrame() {return sizeOfLastFrame;}; - void setSizeOfLastFrame(int sz) {sizeOfLastFrame=sz;}; void computeSizeOfNextRtp(); RtpQueueItem *items[kRtpQueueSize]; int head; // Pointer to last inserted item int tail; // Pointer to the oldest item int nItems; - int sizeOfLastFrame; + int sizeOfLastFrame; // Size of last frame in bytes int bytesInQueue_; int sizeOfQueue_; diff --git a/code/ScreamRx.cpp b/code/ScreamRx.cpp index c219953..ec4a662 100644 --- a/code/ScreamRx.cpp +++ b/code/ScreamRx.cpp @@ -308,7 +308,7 @@ bool ScreamRx::createStandardizedFeedback(uint32_t time_ntp, bool isMark, unsign * stream in the first iteration, a bit unnecessary. */ Stream *stream = NULL; - uint32_t minT_ntp = ULONG_MAX; + uint32_t minT_ntp = UINT32_MAX; for (auto it = streams.begin(); it != streams.end(); ++it) { uint32_t diffT_ntp = time_ntp - (*it)->lastFeedbackT_ntp; if (((*it)->nRtpSinceLastRtcp >= std::min(8,ackDiff) || diffT_ntp > 655 || isMark) && // 10ms in Q16 diff --git a/code/ScreamTx.cpp b/code/ScreamTx.cpp index a29e7e4..86c85d1 100644 --- a/code/ScreamTx.cpp +++ b/code/ScreamTx.cpp @@ -154,7 +154,7 @@ ScreamTx::ScreamTx(float lossBeta_, bytesNewlyAckedLog(0), ecnCeMarkedBytesLog(0), - isUseExtraDetailedLog(false), + isUseExtraDetailedLog(false), fp_log(0), completeLogItem(false) { @@ -531,7 +531,7 @@ float ScreamTx::addTransmitted(uint32_t time_ntp, uint32_t ssrc, int size, uint16_t seqNr, - bool isMark) { + bool isMark) { if (!isInitialized) initialize(time_ntp); @@ -634,7 +634,7 @@ void ScreamTx::incomingStandardizedFeedback(uint32_t time_ntp, ptr += 2; begin_seq = ntohs(begin_seq); num_reports = ntohs(num_reports) + 1; - end_seq = begin_seq+num_reports-1; + end_seq = begin_seq+num_reports-1; /* * Validate RTCP feedback message @@ -704,17 +704,17 @@ void ScreamTx::incomingStandardizedFeedback(uint32_t time_ntp, Transmitted *txPackets = stream->txPackets; completeLogItem = false; /* - * Mark received packets, given by the ACK vector - */ - bool isMark = false; + * Mark received packets, given by the ACK vector + */ + bool isMark = false; isCeThisFeedback |= markAcked(time_ntp, txPackets, seqNr, timestamp, stream, ceBits, ecnCeMarkedBytesLog, isLast, isMark); /* - * Detect lost packets - */ + * Detect lost packets + */ if (isUseExtraDetailedLog || isLast || isMark) { detectLoss(time_ntp, txPackets, seqNr, stream); - } + } if (isLast) { if (isCeThisFeedback && time_ntp - lastLossEventT_ntp > sRtt_ntp) { @@ -780,16 +780,16 @@ void ScreamTx::incomingStandardizedFeedback(uint32_t time_ntp, if (fp_log && completeLogItem) { fprintf(fp_log, " %d,%d,%d,%1.0f,%d,%d,%d,%d,%1.0f,%1.0f,%1.0f,%1.0f,%1.0f,%d", cwnd, bytesInFlight, inFastStart, rateTransmitted, streamId, seqNr, bytesNewlyAckedLog, ecnCeMarkedBytesLog, stream->rateRtp, stream->rateTransmitted, stream->rateAcked, stream->rateLost, stream->rateCe,isMark); - if (strlen(detailedLogExtraData) > 0) { - fprintf(fp_log, ",%s", detailedLogExtraData); - } - bytesNewlyAckedLog = 0; - ecnCeMarkedBytesLog = 0; + if (strlen(detailedLogExtraData) > 0) { + fprintf(fp_log, ",%s", detailedLogExtraData); + } + bytesNewlyAckedLog = 0; + ecnCeMarkedBytesLog = 0; } if (fp_log && completeLogItem) { fprintf(fp_log, "\n"); } - } + } } @@ -819,7 +819,7 @@ bool ScreamTx::markAcked(uint32_t time_ntp, */ if ((tmp->seqNr == seqNr) & !tmp->isAcked) { bytesDeliveredThisRtt += tmp->size; - isMark = tmp->isMark; + isMark = tmp->isMark; if (ceBits == 0x03) { /* * Packet was CE marked, increase counter @@ -1064,7 +1064,7 @@ void ScreamTx::initialize(uint32_t time_ntp) { float ScreamTx::getTotalTargetBitrate() { float totalTargetBitrate = 0.0f; for (int n = 0; n < nStreams; n++) { - totalTargetBitrate += streams[n]->targetBitrate; + totalTargetBitrate += streams[n]->targetBitrate; } return totalTargetBitrate; } @@ -1135,7 +1135,7 @@ void ScreamTx::updateCwnd(uint32_t time_ntp) { */ paceInterval = kMinPaceInterval; if ((queueDelayFractionAvg > 0.02f || isL4s || maxTotalBitrate > 0) && kEnablePacketPacing) { - float pacingBitrate = std::max(1.0e5f, packetPacingHeadroom*getTotalTargetBitrate()); + float pacingBitrate = std::max(1.0e5f, packetPacingHeadroom*getTotalTargetBitrate()); if (maxTotalBitrate > 0) { pacingBitrate = std::min(pacingBitrate, maxTotalBitrate); } @@ -1986,7 +1986,7 @@ void ScreamTx::Stream::updateTargetBitrate(uint32_t time_ntp) { */ float sclI = (targetBitrate - targetBitrateI) / targetBitrateI; sclI *= 4; - sclI = sclI*sclI; + sclI = sclI*sclI; sclI = std::max(0.05f, std::min(1.0f, sclI)); float increment = 0.0f; diff --git a/code/ScreamTx.h b/code/ScreamTx.h index a61604c..f1189b5 100644 --- a/code/ScreamTx.h +++ b/code/ScreamTx.h @@ -4,7 +4,7 @@ #include #include #include -extern "C" { + using namespace std; /* @@ -50,7 +50,7 @@ static const float kGainDown = 2.0f; // Max video rampup speed in bps/s (bits per second increase per second) static const float kRampUpSpeed = 200000.0f; // bps/s // Max video rampup scale as fraction of the current target bitrate -static const float kRampUpScale = 0.2f; +static const float kRampUpScale = 0.2f; // Max RTP queue delay, RTP queue is cleared if this value is exceeded static const float kMaxRtpQueueDelay = 0.1; // 0.1s // Compensation factor for RTP queue size @@ -193,7 +193,7 @@ class ScreamTx { uint32_t ssrc, int size, uint16_t seqNr, - bool isMark); + bool isMark); /* New incoming feedback, this function * triggers a CWND update @@ -279,9 +279,9 @@ class ScreamTx { fp_log = fp; } - void setTimeString(char *s) { - strcpy(timeString,s); - } + void setTimeString(char *s) { + strcpy(timeString,s); + } /* * extra data to be appended to detailed log @@ -290,21 +290,21 @@ class ScreamTx { strcpy(detailedLogExtraData,s); } - /* - * Get the list of log items - */ - char *getDetailedLogItemList() { - return "\"Time [s]\",\"Estimated queue delay [s]\",\"RTT [s]\",\"Congestion window [byte]\",\"Bytes in flight [byte]\",\"Fast increase mode\",\"Total transmit bitrate [bps]\",\"Stream ID\",\"RTP SN\",\"Bytes newly ACKed\",\"Bytes newly ACKed and CE marked\",\"Media coder bitrate [bps]\",\"Transmitted bitrate [bps]\",\"ACKed bitrate [bps]\",\"Lost bitrate [bps]\",\"CE Marked bitrate [bps]\",\"Marker bit set\""; - } - - /* - * Log each ACKed packet, - */ - void useExtraDetailedLog(bool isUseExtraDetailedLog_) { - isUseExtraDetailedLog = isUseExtraDetailedLog_; - } - - /* + /* + * Get the list of log items + */ + const char *getDetailedLogItemList() { + return "\"Time [s]\",\"Estimated queue delay [s]\",\"RTT [s]\",\"Congestion window [byte]\",\"Bytes in flight [byte]\",\"Fast increase mode\",\"Total transmit bitrate [bps]\",\"Stream ID\",\"RTP SN\",\"Bytes newly ACKed\",\"Bytes newly ACKed and CE marked\",\"Media coder bitrate [bps]\",\"Transmitted bitrate [bps]\",\"ACKed bitrate [bps]\",\"Lost bitrate [bps]\",\"CE Marked bitrate [bps]\",\"Marker bit set\""; + } + + /* + * Log each ACKed packet, + */ + void useExtraDetailedLog(bool isUseExtraDetailedLog_) { + isUseExtraDetailedLog = isUseExtraDetailedLog_; + } + + /* * Set lowest possible cwndMin */ void setCwndMinLow(int aValue) { @@ -319,7 +319,7 @@ class ScreamTx { uint32_t timeTx_ntp; int size; uint16_t seqNr; - bool isMark; + bool isMark; bool isUsed; bool isAcked; bool isAfterReceivedEdge; @@ -465,12 +465,12 @@ class ScreamTx { uint8_t ceBits, int &encCeMarkedBytes, bool isLast, - bool &isMark); + bool &isMark); - /* - * Get total target bitrate for all streams - */ - float getTotalTargetBitrate(); + /* + * Get total target bitrate for all streams + */ + float getTotalTargetBitrate(); /* * Update CWND @@ -700,12 +700,11 @@ class ScreamTx { */ FILE *fp_log; bool completeLogItem; - char timeString[100]; - bool isUseExtraDetailedLog; + char timeString[100]; + bool isUseExtraDetailedLog; int bytesNewlyAckedLog; - int ecnCeMarkedBytesLog; + int ecnCeMarkedBytesLog; }; -} #endif diff --git a/code/VideoEnc.cpp b/code/VideoEnc.cpp index db532a8..bac9a9b 100644 --- a/code/VideoEnc.cpp +++ b/code/VideoEnc.cpp @@ -55,4 +55,3 @@ int VideoEnc::encode(float time) { rtpQueue->setSizeOfLastFrame(rtpBytes); return rtpBytes; } - diff --git a/code/VideoEnc.h b/code/VideoEnc.h index 45d29b5..2e80e5e 100644 --- a/code/VideoEnc.h +++ b/code/VideoEnc.h @@ -21,5 +21,4 @@ class VideoEnc { int ix; }; - -#endif \ No newline at end of file +#endif diff --git a/code/gscream/gscream_app_rpi_tx.cpp b/code/gscream/gscream_app_rpi_tx.cpp index cf07e7b..0b8fab4 100644 --- a/code/gscream/gscream_app_rpi_tx.cpp +++ b/code/gscream/gscream_app_rpi_tx.cpp @@ -39,7 +39,7 @@ int main (int argc, char *argv[]) #ifdef SCREAM gscreamtx = gst_element_factory_make ("gscreamtx", "scream-tx"); g_assert (gscreamtx); -#endif +#endif g_assert (videoencode); g_assert (capsfilter); @@ -105,7 +105,7 @@ int main (int argc, char *argv[]) srcpad = gst_element_get_static_pad (gscreamtx, "src"); #else srcpad = gst_element_get_static_pad (videopayload, "src"); -#endif +#endif if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK) g_error ("Failed to link video payloader to rtpbin"); gst_object_unref (srcpad); diff --git a/code/gscream/gst-gscreamrx/gst-plugin/COPYING b/code/gscream/gst-gscreamrx/gst-plugin/COPYING index 09ec995..49b9c3c 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/COPYING +++ b/code/gscream/gst-gscreamrx/gst-plugin/COPYING @@ -1,2 +1 @@ Put your license in here! - diff --git a/code/gscream/gst-gscreamrx/gst-plugin/ChangeLog b/code/gscream/gst-gscreamrx/gst-plugin/ChangeLog index 5c25746..7ead349 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/ChangeLog +++ b/code/gscream/gst-gscreamrx/gst-plugin/ChangeLog @@ -104,7 +104,7 @@ 2006-04-20 Stefan Kost - Patch by: Johan Rydberg + Patch by: Johan Rydberg * src/gstplugin.c: (gst_plugin_template_get_type), (gst_plugin_template_base_init), (gst_plugin_template_class_init), @@ -116,7 +116,7 @@ (gst_plugin_template_get_property): * tools/make_element: remove double gst_get_, fix '_' in names - + 2006-02-26 Tim-Philipp Müller @@ -190,8 +190,8 @@ * autogen.sh: * configure.ac: * src/Makefile.am: - use proper LDFLAGS for plugins - run in maintainer mode by default + use proper LDFLAGS for plugins + run in maintainer mode by default 2004-04-22 Thomas Vander Stichele @@ -210,8 +210,8 @@ 2003-02-06 Thomas Vander Stichele - * updated for GStreamer 0.6.0 + * updated for GStreamer 0.6.0 2002-07-17 Thomas Vander Stichele - * initial creation on a flight to New York + * initial creation on a flight to New York diff --git a/code/gscream/gst-gscreamrx/gst-plugin/README b/code/gscream/gst-gscreamrx/gst-plugin/README index 1905684..1236ac2 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/README +++ b/code/gscream/gst-gscreamrx/gst-plugin/README @@ -9,7 +9,7 @@ of how to set up autotools and your source tree. This template demonstrates : - what to do in autogen.sh - how to setup configure.ac (your package name and version, GStreamer flags) -- how to setup your source dir +- how to setup your source dir - what to put in Makefile.am More features and templates might get added later on. @@ -31,4 +31,3 @@ one element called 'myfilter' too. Also look for "FIXME:" markers that point you to places where you need to edit the code. You still need to adjust the Makefile.am. - diff --git a/code/gscream/gst-gscreamrx/gst-plugin/autogen.sh b/code/gscream/gst-gscreamrx/gst-plugin/autogen.sh old mode 100644 new mode 100755 diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.cpp b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.cpp index 9e0400c..e54f33d 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.cpp +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.cpp @@ -1 +1 @@ -../../../../ScreamRx.cpp \ No newline at end of file +#include "../../../../ScreamRx.cpp" diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.h b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.h index 85beb59..53510ee 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.h +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamRx.h @@ -1 +1 @@ -../../../../ScreamRx.h \ No newline at end of file +#include "../../../../ScreamRx.h" diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamTx.h b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamTx.h index 48065bc..ab083d9 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamTx.h +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/ScreamTx.h @@ -1 +1 @@ -../../../../ScreamTx.h \ No newline at end of file +#include "../../../../ScreamTx.h" diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/gstgscreamrx.cpp b/code/gscream/gst-gscreamrx/gst-plugin/src/gstgscreamrx.cpp index bf480c4..ced79f1 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/gstgscreamrx.cpp +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/gstgscreamrx.cpp @@ -375,7 +375,8 @@ static gboolean on_sending_rtcp(GObject *session, GstBuffer *buffer, gboolean ea guint8 buf[2000]; pthread_mutex_lock(&filter->lock_scream); getTime(filter, &time, &time_ntp); - bool isFb = filter->screamRx->createStandardizedFeedback(time_ntp, buf , rtcpSize); + bool isMark = false; //XXX TODO: figure out correct value + bool isFb = filter->screamRx->createStandardizedFeedback(time_ntp, isMark, buf, rtcpSize); pthread_mutex_unlock(&filter->lock_scream); if (isFb && time - filter->lastRxTime < 2.0) { //g_print("TS %X \n",(time_ntp)); diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.cpp b/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.cpp index 44017ea..2b5cee0 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.cpp +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.h b/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.h index f1fe4ed..27c1bef 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.h +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/gstplugin.h @@ -3,7 +3,7 @@ * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation @@ -74,7 +74,7 @@ struct _GstPluginTemplate gboolean silent; }; -struct _GstPluginTemplateClass +struct _GstPluginTemplateClass { GstElementClass parent_class; }; diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.c b/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.c index af6c75b..9352079 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.c +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.c @@ -184,7 +184,7 @@ gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) if (filter->silent == FALSE) g_print ("I'm plugged, therefore I'm in.\n"); - + /* FIXME: do something interesting here. This simply copies the source * to the destination. */ diff --git a/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.h b/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.h index be9ce86..ee9c5dd 100644 --- a/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.h +++ b/code/gscream/gst-gscreamrx/gst-plugin/src/gsttransform.h @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2006 Stefan Kost * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL @@ -18,7 +18,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ - + #ifndef __GST_PLUGIN_TEMPLATE_H__ #define __GST_PLUGIN_TEMPLATE_H__ diff --git a/code/gscream/gst-gscreamtx/gst-plugin/COPYING b/code/gscream/gst-gscreamtx/gst-plugin/COPYING index 09ec995..49b9c3c 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/COPYING +++ b/code/gscream/gst-gscreamtx/gst-plugin/COPYING @@ -1,2 +1 @@ Put your license in here! - diff --git a/code/gscream/gst-gscreamtx/gst-plugin/ChangeLog b/code/gscream/gst-gscreamtx/gst-plugin/ChangeLog index 5c25746..7ead349 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/ChangeLog +++ b/code/gscream/gst-gscreamtx/gst-plugin/ChangeLog @@ -104,7 +104,7 @@ 2006-04-20 Stefan Kost - Patch by: Johan Rydberg + Patch by: Johan Rydberg * src/gstplugin.c: (gst_plugin_template_get_type), (gst_plugin_template_base_init), (gst_plugin_template_class_init), @@ -116,7 +116,7 @@ (gst_plugin_template_get_property): * tools/make_element: remove double gst_get_, fix '_' in names - + 2006-02-26 Tim-Philipp Müller @@ -190,8 +190,8 @@ * autogen.sh: * configure.ac: * src/Makefile.am: - use proper LDFLAGS for plugins - run in maintainer mode by default + use proper LDFLAGS for plugins + run in maintainer mode by default 2004-04-22 Thomas Vander Stichele @@ -210,8 +210,8 @@ 2003-02-06 Thomas Vander Stichele - * updated for GStreamer 0.6.0 + * updated for GStreamer 0.6.0 2002-07-17 Thomas Vander Stichele - * initial creation on a flight to New York + * initial creation on a flight to New York diff --git a/code/gscream/gst-gscreamtx/gst-plugin/README b/code/gscream/gst-gscreamtx/gst-plugin/README index 1905684..1236ac2 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/README +++ b/code/gscream/gst-gscreamtx/gst-plugin/README @@ -9,7 +9,7 @@ of how to set up autotools and your source tree. This template demonstrates : - what to do in autogen.sh - how to setup configure.ac (your package name and version, GStreamer flags) -- how to setup your source dir +- how to setup your source dir - what to put in Makefile.am More features and templates might get added later on. @@ -31,4 +31,3 @@ one element called 'myfilter' too. Also look for "FIXME:" markers that point you to places where you need to edit the code. You still need to adjust the Makefile.am. - diff --git a/code/gscream/gst-gscreamtx/gst-plugin/autogen.sh b/code/gscream/gst-gscreamtx/gst-plugin/autogen.sh old mode 100644 new mode 100755 diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.cpp b/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.cpp index e67ad2b..389e2e3 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.cpp +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.cpp @@ -1,156 +1,2 @@ -#include "RtpQueue.h" -#include -#include -using namespace std; -/* -* Implements a simple RTP packet queue -*/ - -RtpQueueItem::RtpQueueItem() { - used = false; - size = 0; - seqNr = 0; -} - - -RtpQueue::RtpQueue() { - for (int n=0; n < kRtpQueueSize; n++) { - items[n] = new RtpQueueItem(); - } - head = -1; - tail = 0; - nItems = 0; - sizeOfLastFrame = 0; - bytesInQueue_ = 0; - sizeOfQueue_ = 0; - sizeOfNextRtp_ = -1; -} - -void RtpQueue::push(void *rtpPacket, int size, unsigned short seqNr, float ts) { - int ix = head+1; - if (ix == kRtpQueueSize) ix = 0; - if (items[ix]->used) { - /* - * RTP queue is full, do a drop tail i.e ignore new RTP packets - */ - return; - } - head = ix; - items[head]->seqNr = seqNr; - items[head]->size = size; - items[head]->ts = ts; - items[head]->used = true; - bytesInQueue_ += size; - sizeOfQueue_ += 1; - memcpy(items[head]->packet, rtpPacket, size); - computeSizeOfNextRtp(); -} - -void RtpQueue::push(GstBuffer *buffer, int size, unsigned short seqNr, float ts) { - int ix = head+1; - if (ix == kRtpQueueSize) ix = 0; - if (items[ix]->used) { - /* - * RTP queue is full, do a drop tail i.e ignore new RTP packets - */ - return; - } - head = ix; - items[head]->seqNr = seqNr; - items[head]->size = size; - items[head]->ts = ts; - items[head]->used = true; - items[head]->buffer = buffer; - bytesInQueue_ += size; - sizeOfQueue_ += 1; - computeSizeOfNextRtp(); -} - -bool RtpQueue::pop(void *rtpPacket, int& size, unsigned short& seqNr) { - if (items[tail]->used == false) { - sizeOfNextRtp_ = -1; - return false; - } else { - size = items[tail]->size; - memcpy(rtpPacket,items[tail]->packet,size); - seqNr = items[tail]->seqNr; - items[tail]->used = false; - bytesInQueue_ -= size; - sizeOfQueue_ -= 1; - tail++; if (tail == kRtpQueueSize) tail = 0; - computeSizeOfNextRtp(); - return true; - } -} - -GstBuffer* RtpQueue::pop(unsigned short& seqNr) { - if (items[tail]->used == false) { - sizeOfNextRtp_ = -1; - return 0; - } else { - GstBuffer *buffer = items[tail]->buffer; - seqNr = items[tail]->seqNr; - items[tail]->used = false; - bytesInQueue_ -= items[tail]->size; - sizeOfQueue_ -= 1; - tail++; if (tail == kRtpQueueSize) tail = 0; - computeSizeOfNextRtp(); - return buffer; - } -} - -void RtpQueue::computeSizeOfNextRtp() { - if (!items[tail]->used) { - sizeOfNextRtp_ = - 1; - } else { - sizeOfNextRtp_ = items[tail]->size; - } -} - -int RtpQueue::sizeOfNextRtp() { - return sizeOfNextRtp_; -} - -int RtpQueue::seqNrOfNextRtp() { - if (!items[tail]->used) { - return -1; - } else { - return items[tail]->seqNr; - } -} - -int RtpQueue::bytesInQueue() { - return bytesInQueue_; -} - -int RtpQueue::sizeOfQueue() { - return sizeOfQueue_; -} - -float RtpQueue::getDelay(float currTs) { - if (items[tail]->used == false) { - return 0; - } else { - return currTs-items[tail]->ts; - } -} - -bool RtpQueue::sendPacket(void *rtpPacket, int& size, unsigned short& seqNr) { - if (sizeOfQueue() > 0) { - pop(rtpPacket, size, seqNr); - return true; - } - return false; -} - -void RtpQueue::clear() { - for (int n=0; n < kRtpQueueSize; n++) { - items[n]->used = false; - } - head = -1; - tail = 0; - nItems = 0; - bytesInQueue_ = 0; - sizeOfQueue_ = 0; - sizeOfNextRtp_ = -1; -} +#define GSCREAM +#include "../../../../RtpQueue.cpp" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.h b/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.h index 88780a8..e9a68d9 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.h +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/RtpQueue.h @@ -1,64 +1,2 @@ -#ifndef RTP_QUEUE -#define RTP_QUEUE - -#include - -/* - * Implements a simple RTP packet queue, one RTP queue - * per stream {SSRC,PT} - */ - -class RtpQueueIface { -public: - virtual void clear() = 0; - virtual int sizeOfNextRtp() = 0; - virtual int seqNrOfNextRtp() = 0; - virtual int bytesInQueue() = 0; // Number of bytes in queue - virtual int sizeOfQueue() = 0; // Number of items in queue - virtual float getDelay(float currTs) = 0; - virtual int getSizeOfLastFrame() = 0; -}; - -class RtpQueueItem { -public: - RtpQueueItem(); - char packet[2000]; - int size; - unsigned short seqNr; - float ts; - bool used; - GstBuffer *buffer; -}; - -const int kRtpQueueSize = 1024; -class RtpQueue : public RtpQueueIface { -public: - RtpQueue(); - - void push(void *rtpPacket, int size, unsigned short seqNr, float ts); - void push(GstBuffer *buf, int size, unsigned short seqNr, float ts); - bool pop(void *rtpPacket, int &size, unsigned short &seqNr); - GstBuffer* pop(unsigned short &seqNr); - int sizeOfNextRtp(); - int seqNrOfNextRtp(); - int bytesInQueue(); // Number of bytes in queue - int sizeOfQueue(); // Number of items in queue - float getDelay(float currTs); - bool sendPacket(void *rtpPacket, int &size, unsigned short &seqNr); - void clear(); - void setSizeOfLastFrame(int sz) { sizeOfLastFrame = sz; }; - int getSizeOfLastFrame() {return sizeOfLastFrame;}; - void computeSizeOfNextRtp(); - - RtpQueueItem *items[kRtpQueueSize]; - int head; // Pointer to last inserted item - int tail; // Pointer to the oldest item - int nItems; - int sizeOfLastFrame; // Size of last frame in bytes - - int bytesInQueue_; - int sizeOfQueue_; - int sizeOfNextRtp_; -}; - -#endif +#define GSCREAM +#include "../../../../RtpQueue.h" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.cpp b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.cpp index 9e0400c..e54f33d 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.cpp +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.cpp @@ -1 +1 @@ -../../../../ScreamRx.cpp \ No newline at end of file +#include "../../../../ScreamRx.cpp" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.h b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.h index 85beb59..53510ee 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.h +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamRx.h @@ -1 +1 @@ -../../../../ScreamRx.h \ No newline at end of file +#include "../../../../ScreamRx.h" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.cpp b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.cpp index ac02df8..f2119f1 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.cpp +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.cpp @@ -1 +1 @@ -../../../../ScreamTx.cpp \ No newline at end of file +#include "../../../../ScreamTx.cpp" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.h b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.h index 48065bc..ab083d9 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.h +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/ScreamTx.h @@ -1 +1 @@ -../../../../ScreamTx.h \ No newline at end of file +#include "../../../../ScreamTx.h" diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/gstgscreamtx.cpp b/code/gscream/gst-gscreamtx/gst-plugin/src/gstgscreamtx.cpp index b160693..ff99b0c 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/gstgscreamtx.cpp +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/gstgscreamtx.cpp @@ -528,8 +528,8 @@ gst_g_scream_tx_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) //g_print("CALLBACK\n"); filter->encoder = gst_bin_get_by_name_recurse_up(GST_BIN(pipe), "video"); g_assert(filter->encoder); - - + + //g_object_set(G_OBJECT(filter->encoder), "bitrate", 200, NULL); //filter->encoder = gst_bin_get_by_name_recurse_up(GST_BIN(pipe), "encoder"); diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/gstplugin.cpp b/code/gscream/gst-gscreamtx/gst-plugin/src/gstplugin.cpp index 44017ea..2b5cee0 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/gstplugin.cpp +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/gstplugin.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.c b/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.c index af6c75b..9352079 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.c +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.c @@ -184,7 +184,7 @@ gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) if (filter->silent == FALSE) g_print ("I'm plugged, therefore I'm in.\n"); - + /* FIXME: do something interesting here. This simply copies the source * to the destination. */ diff --git a/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.h b/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.h index be9ce86..ee9c5dd 100644 --- a/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.h +++ b/code/gscream/gst-gscreamtx/gst-plugin/src/gsttransform.h @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2006 Stefan Kost * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL @@ -18,7 +18,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ - + #ifndef __GST_PLUGIN_TEMPLATE_H__ #define __GST_PLUGIN_TEMPLATE_H__ diff --git a/code/scream_receiver.cpp b/code/scream_receiver.cpp index 055ab0e..606b31c 100644 --- a/code/scream_receiver.cpp +++ b/code/scream_receiver.cpp @@ -29,12 +29,12 @@ ScreamRx *screamRx = 0; //int fd_local_rtp; -char* SENDER_IP = "192.168.0.20"; +const char *SENDER_IP = "192.168.0.20"; int INCOMING_RTP_PORT = 30122; struct sockaddr_in incoming_rtp_addr, outgoing_rtcp_addr, sender_rtcp_addr; struct sockaddr_in local_rtp_addr; -char* LOCAL_IP = "127.0.0.1"; +const char *LOCAL_IP = "127.0.0.1"; int LOCAL_PORT = 30124; int ackDiff = -1; diff --git a/code/scream_sender.cpp b/code/scream_sender.cpp index 8adffca..804c9e5 100644 --- a/code/scream_sender.cpp +++ b/code/scream_sender.cpp @@ -87,9 +87,9 @@ RtpQueue *rtpQueue = 0; // We don't bother about SSRC in this implementation, it is only one stream -char *DECODER_IP = "192.168.0.21"; +const char *DECODER_IP = "192.168.0.21"; int DECODER_PORT = 30110; -char *DUMMY_IP = "217.10.68.152"; // Dest address just to punch hole in NAT +const char *DUMMY_IP = "217.10.68.152"; // Dest address just to punch hole in NAT int SIERRA_PYTHON_PORT = 35000; diff --git a/code/scream_v_a.cpp b/code/scream_v_a.cpp index 403f3f0..eb5ee9e 100644 --- a/code/scream_v_a.cpp +++ b/code/scream_v_a.cpp @@ -22,7 +22,7 @@ int swprio = -1; //#define TRACEFILE "../traces/trace_no_key_smooth.txt" /* * Mode determines how many streams should be run -* 1 = audio, 2 = video, 3 = 1+2, 4 = +* 1 = audio, 2 = video, 3 = 1+2, 4 = */ const int mode = 0x01; const double timeBase = 10000.0; @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) netQueueRate->rate = 50000e3; } } - + if (time > 30 && swprio == 0) { swprio = 1; screamTx->setTargetPriority(10, 0.2); @@ -208,7 +208,7 @@ int main(int argc, char* argv[]) if (false && time > 50) netQueueRate->rate = 8e6; - + /* if ((time >= 60) && (time < 80) && isChRate) @@ -230,4 +230,3 @@ int main(int argc, char* argv[]) return 0; } - diff --git a/code/stdafx.h b/code/stdafx.h index cf009df..1847421 100644 --- a/code/stdafx.h +++ b/code/stdafx.h @@ -18,4 +18,3 @@ #include #include #include - diff --git a/plot_cdf.m b/plot_cdf.m index a2d249f..3c5ba8b 100644 --- a/plot_cdf.m +++ b/plot_cdf.m @@ -1,12 +1,12 @@ function plot_cdf(a,Tlim,Tmax) -% This function plots the CDF of the RTT and -% queue delay from the logs given by the +% This function plots the CDF of the RTT and +% queue delay from the logs given by the % SCReAM BW test tool. % Parameters : % a : log file from SCReAM BW test tool % imported with the command % a = load(); -% where is the name of the log file +% where is the name of the log file % Tlim : xmin and xmax limits [s], e.g. [0 100] % Tmax : Max displayed value for RTT/delay % @@ -17,7 +17,7 @@ function plot_cdf(a,Tlim,Tmax) % >a = a(1:50:end,:); % subsample the log file % >figure(1); % >plot_cdf(.... -% +% T = a(:,1); ix = intersect(find(T > Tlim(1)),find(T <= Tlim(2))); @@ -35,4 +35,3 @@ function plot_cdf(a,Tlim,Tmax) xlabel('[s]'); end - diff --git a/plot_thp_delay.m b/plot_thp_delay.m index 4d613a5..2a46390 100644 --- a/plot_thp_delay.m +++ b/plot_thp_delay.m @@ -1,11 +1,11 @@ function plot_thp_delay(a,Tlim,maxThp,maxDelay) -% This function plots the thorughput +% This function plots the thorughput % RTT and estimated queue delay % Parameters: % a : log file from SCReAM BW test tool % imported with the command % a = load(); -% where is the name of the log file +% where is the name of the log file % Tlim : xmin and xmax limits [s], e.g. [0 100] % maxThp : Max thorughput [Mbps] % maxDelay : Max delay [s] @@ -17,7 +17,7 @@ function plot_thp_delay(a,Tlim,maxThp,maxDelay) % >a = a(1:50:end,:); % subsample the log file % >figure(1); % >plot_cdf(.... -% +% T = a(:,1); subplot(211);%subplot(9,1,1:5); K = 5; @@ -43,4 +43,3 @@ function plot_thp_delay(a,Tlim,maxThp,maxDelay) xlabel('T [s]'); xlim(Tlim); end - diff --git a/test_v_a.m b/test_v_a.m index 16969f1..588a26b 100644 --- a/test_v_a.m +++ b/test_v_a.m @@ -3,26 +3,26 @@ function test_v_a(a,Tmax,I,Bmax,Cmax) K = 12; %Tmax = 100.0; - + figure(1); subplot(2,1,1); - plot(T,a(:,2),T,a(:,3));%,T,a(:,4)); + plot(T,a(:,2),T,a(:,3));%,T,a(:,4)); set(gca,'FontSize',12);grid on; - set(gca,'XTickLabel',[]); + set(gca,'XTickLabel',[]); axis([0 Tmax 0 0.2]);grid on; title('qdel[s]'); - + subplot(2,1,2); plot(T,a(:,4),T,a(:,5),T,a(:,7)*20000,'k'); set(gca,'FontSize',12);grid on; - axis([0 Tmax 0 Cmax]);grid on; - title('CWND & in flight [byte]'); + axis([0 Tmax 0 Cmax]);grid on; + title('CWND & in flight [byte]'); xlabel('T [s]'); if I>0 figure(2); subplot(2,1,1); - plot(T,a(:,8)); + plot(T,a(:,8)); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 0.2]);grid on; set(gca,'XTickLabel',[]); @@ -31,15 +31,15 @@ function test_v_a(a,Tmax,I,Bmax,Cmax) plot(T,a(:,9)/1000,T,a(:,11)/1000,T,a(:,10)/1000); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 Bmax(1)]);grid on; - title('Bitrate [Mbps]'); + title('Bitrate [Mbps]'); legend('Target','Transmitted', 'RTP'); xlabel('T [s]'); end if I>1 - K = 6; + K = 6; figure(3); subplot(2,1,1); - plot(T,a(:,8+K)); + plot(T,a(:,8+K)); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 0.2]);grid on; set(gca,'XTickLabel',[]); @@ -48,15 +48,15 @@ function test_v_a(a,Tmax,I,Bmax,Cmax) plot(T,a(:,9+K)/1000,T,a(:,11+K)/1000,T,a(:,10+K)/1000); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 Bmax(2)]);grid on; - title('Bitrate [kbps]'); + title('Bitrate [kbps]'); legend('Target','Transmitted', 'RTP'); xlabel('T [s]'); end - if I>2 - K = 12; + if I>2 + K = 12; figure(4); subplot(2,1,1); - plot(T,a(:,8+K)); + plot(T,a(:,8+K)); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 0.1]);grid on; set(gca,'XTickLabel',[]); @@ -65,8 +65,7 @@ function test_v_a(a,Tmax,I,Bmax,Cmax) plot(T,a(:,9+K),T,a(:,11+K),T,a(:,10+K)); set(gca,'FontSize',12);grid on; axis([0 Tmax 0 Bmax(3)]);grid on; - title('Bitrate [kbps]'); + title('Bitrate [kbps]'); legend('Target','Transmitted', 'RTP'); xlabel('T [s]'); end - \ No newline at end of file