Commit 6e194ebf authored by Andreas Schmidt's avatar Andreas Schmidt

Default target delay set to 1s.

parent bb457216
......@@ -10,6 +10,8 @@ PrrtApplicationConstraints *PrrtApplicationConstraints_create()
pthread_mutex_init(&constraints->lock, NULL);
constraints->targetDelay_us = 1000*1000;
return constraints;
error:
......@@ -27,7 +29,7 @@ bool PrrtApplicationConstraints_destroy(PrrtApplicationConstraints *applicationC
prrtTimedelta_t PrrtApplicationConstraints_get_target_delay(PrrtApplicationConstraints *applicationConstraints)
{
pthread_mutex_lock(&applicationConstraints->lock);
prrtTimedelta_t targetDelay = applicationConstraints->targetDelay;
prrtTimedelta_t targetDelay = applicationConstraints->targetDelay_us;
pthread_mutex_unlock(&applicationConstraints->lock);
return targetDelay;
}
......@@ -35,7 +37,7 @@ prrtTimedelta_t PrrtApplicationConstraints_get_target_delay(PrrtApplicationConst
bool PrrtApplicationConstraints_set_target_delay(PrrtApplicationConstraints *applicationConstraints, prrtTimedelta_t targetDelay)
{
pthread_mutex_lock(&applicationConstraints->lock);
applicationConstraints->targetDelay = targetDelay;
applicationConstraints->targetDelay_us = targetDelay;
pthread_mutex_unlock(&applicationConstraints->lock);
return true;
}
......@@ -4,7 +4,7 @@
#include "packet.h"
typedef struct applicationConstraints {
prrtTimedelta_t targetDelay;
prrtTimedelta_t targetDelay_us;
pthread_mutex_t lock;
} PrrtApplicationConstraints;
......
......@@ -13,13 +13,6 @@ prrtTimestamp_t PrrtClock_get_current_time_us()
return (prrtTimestamp_t) (1000000 * tv.tv_sec + tv.tv_usec);
}
prrtTimestamp_t PrrtClock_get_current_time_ms()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (uint32_t) (1000 * tv.tv_sec + tv.tv_usec / 1000);
}
prrtTimestamp_t PrrtClock_get_prrt_time_us(PrrtClock *clock)
{
prrtTimestamp_t currentTime = PrrtClock_get_current_time_us();
......@@ -41,7 +34,7 @@ bool PrrtClock_update(PrrtClock *clock, uint32_t referenceTime, uint32_t rtt)
prrtTimestamp_t currentTime = PrrtClock_get_current_time_us();
prrtTimestamp_t virtualTime = clock->virtualTime;
int32_t clockSkew = clock->skew;
prrtTimedelta_t delay = rtt /2; // half the rtt
prrtTimedelta_t delay = rtt/2; // half the rtt
int32_t phaseError = (int32_t) diff_ts(referenceTime, virtualTime) + delay;
//debug("Virtual Time: %u, Current Time: %u, Phase Error: %d, Delay: %u, Skew: %d", virtualTime, currentTime, phaseError, delay, clockSkew);
......
......@@ -20,7 +20,7 @@ PrrtClock* PrrtClock_create(void);
bool PrrtClock_destroy(PrrtClock* clock);
prrtTimestamp_t PrrtClock_get_current_time_us(void);
prrtTimestamp_t PrrtClock_get_current_time_ms(void);
prrtTimestamp_t PrrtClock_get_prrt_time_us(PrrtClock *clock);
bool PrrtClock_update(PrrtClock *clock, prrtTimestamp_t referenceTime, prrtTimedelta_t rtt);
......
......@@ -100,8 +100,7 @@ bool PrrtSocket_bind(PrrtSocket *sock_ptr, const char* ipAddress, const uint16_t
"Cannot create data receiving thread.");
}
check(pthread_create(&sock_ptr->cleanupThread, NULL, cleanup, (void *) sock_ptr) ==
EXIT_SUCCESS, "Cannot create cleanup thread.");
check(pthread_create(&sock_ptr->cleanupThread, NULL, cleanup, (void *) sock_ptr) == EXIT_SUCCESS, "Cannot create cleanup thread.");
return true;
error:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment