Loading prrt/proto/channelStateInformation.c +12 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,10 @@ PrrtChannelStateInformation * PrrtChannelStateInformation_create() PrrtChannelStateInformation *csi = calloc(1, sizeof(PrrtChannelStateInformation)); check_mem(csi); check(pthread_mutex_init(&csi->lock, NULL) == 0, "Mutex init failed."); pthread_mutexattr_t attr; check(pthread_mutexattr_init(&attr) == EXIT_SUCCESS, "Mutex attr init failed."); check(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == EXIT_SUCCESS, "Setting type failed."); check(pthread_mutex_init(&csi->lock, &attr) == 0, "Mutex init failed."); csi->rtprop = TIMESTAMP_SPACE; csi->rtprop_filter_length_us = 2 * 1000 * 1000; // 2 seconds Loading Loading @@ -76,9 +79,15 @@ bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation *csi) } prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation *csi) { return csi->plr; pthread_mutex_lock(&csi->lock); prrtPacketLossRate_t res = csi->plr; pthread_mutex_unlock(&csi->lock); return res; } prrtDeliveryRate_t PrrtChannelStateInformation_get_delivery_rate(PrrtChannelStateInformation *csi) { return csi->deliveryRate; pthread_mutex_lock(&csi->lock); prrtDeliveryRate_t res = csi->deliveryRate; pthread_mutex_unlock(&csi->lock); return res; } No newline at end of file Loading
prrt/proto/channelStateInformation.c +12 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,10 @@ PrrtChannelStateInformation * PrrtChannelStateInformation_create() PrrtChannelStateInformation *csi = calloc(1, sizeof(PrrtChannelStateInformation)); check_mem(csi); check(pthread_mutex_init(&csi->lock, NULL) == 0, "Mutex init failed."); pthread_mutexattr_t attr; check(pthread_mutexattr_init(&attr) == EXIT_SUCCESS, "Mutex attr init failed."); check(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == EXIT_SUCCESS, "Setting type failed."); check(pthread_mutex_init(&csi->lock, &attr) == 0, "Mutex init failed."); csi->rtprop = TIMESTAMP_SPACE; csi->rtprop_filter_length_us = 2 * 1000 * 1000; // 2 seconds Loading Loading @@ -76,9 +79,15 @@ bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation *csi) } prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation *csi) { return csi->plr; pthread_mutex_lock(&csi->lock); prrtPacketLossRate_t res = csi->plr; pthread_mutex_unlock(&csi->lock); return res; } prrtDeliveryRate_t PrrtChannelStateInformation_get_delivery_rate(PrrtChannelStateInformation *csi) { return csi->deliveryRate; pthread_mutex_lock(&csi->lock); prrtDeliveryRate_t res = csi->deliveryRate; pthread_mutex_unlock(&csi->lock); return res; } No newline at end of file