Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
82fa5a5e
Commit
82fa5a5e
authored
Mar 10, 2016
by
Andreas Schmidt
Browse files
Update size of rtt fields.
parent
8d65f984
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/prrt/channelStateInformation.c
View file @
82fa5a5e
...
...
@@ -20,8 +20,8 @@ void PrrtChannelStateInformation_update_rtt(PrrtChannelStateInformation *csi, ui
{
int32_t
delta
=
rtt
-
csi
->
rttMean
;
// TODO: ensure that there are no arithemtic problems via rounding etc.
csi
->
rttMean
=
(
uint
32
_t
)
(
csi
->
rttMean
+
RRT_ALPHA
*
delta
);
csi
->
rttDev
=
(
uint
32
_t
)
(
csi
->
rttDev
+
RRT_ALPHA
*
(
labs
(
delta
)
-
csi
->
rttDev
));
csi
->
rttMean
=
(
uint
16
_t
)
(
csi
->
rttMean
+
RRT_ALPHA
*
delta
);
csi
->
rttDev
=
(
uint
16
_t
)
(
csi
->
rttDev
+
RRT_ALPHA
*
(
labs
(
delta
)
-
csi
->
rttDev
));
}
void
PrrtChannelStateInformation_print
(
PrrtChannelStateInformation
*
csi
)
...
...
src/prrt/channelStateInformation.h
View file @
82fa5a5e
...
...
@@ -4,8 +4,8 @@
#include
<stdint.h>
typedef
struct
prrtChannelStateInformation
{
uint
32
_t
rttMean
;
uint
32
_t
rttDev
;
uint
16
_t
rttMean
;
uint
16
_t
rttDev
;
}
PrrtChannelStateInformation
;
void
PrrtChannelStateInformation_init
(
PrrtChannelStateInformation
*
csi
);
...
...
src/prrt/packet.c
View file @
82fa5a5e
...
...
@@ -483,9 +483,4 @@ PrrtPacket *PrrtPacket_create_feedback_packet(uint8_t priority, uint8_t index, u
error:
return
NULL
;
}
uint32_t
PrrtPacket_get_data_timestamp
(
PrrtPacket
*
packet
)
{
PrrtPacketDataPayload
*
payload
=
packet
->
payload
;
return
payload
->
timestamp
;
}
\ No newline at end of file
src/prrt/packet.h
View file @
82fa5a5e
...
...
@@ -82,6 +82,6 @@ int PrrtPacket_destroy(PrrtPacket *packet);
#define PrrtPacket_copy_payload_to_buffer(dst, packet, header_size) memcpy(dst, packet->payload + header_size, packet->payload_len - header_size);
#define PrrtPacket_copy_buffer_to_payload(packet, src, header_size) memcpy(packet->payload + header_size, src, packet->payload_len - header_size);
uint32_t
PrrtPacket_get_data_timestamp
(
PrrtPacket
*
packet
)
;
#define
PrrtPacket_get_data_timestamp(
packet) ((PrrtPacketDataPayload*) packet->payload)->timestamp
;
#endif //PRRT_FRAME_H
src/prrt/processes/data_receiver.c
View file @
82fa5a5e
...
...
@@ -103,6 +103,10 @@ void *receive_data_loop(void *ptr)
check_mem
(
packet
);
check
(
PrrtPacket_decode
(
buffer
,
(
uint16_t
)
n
,
packet
),
"Decode failed."
);
// TODO: make something useful with RTT approximation
PrrtPacketDataPayload
*
payload
=
packet
->
payload
;
debug
(
"RTT: %d"
,
payload
->
group_round_trip_time
);
sock_ptr
->
lastSentTimestamp
=
PrrtPacket_get_data_timestamp
(
packet
);
check
(
send_feedback
(
sock_ptr
,
remote
),
"Sending feedback failed."
);
...
...
src/prrt/processes/data_transmitter.c
View file @
82fa5a5e
...
...
@@ -80,6 +80,10 @@ void * send_data_loop(void *ptr) {
packet
->
seqno
=
sock_ptr
->
sequenceNumberSource
++
;
packet
->
index
=
(
uint8_t
)
(
packet
->
seqno
-
block
->
baseSequenceNumber
);
PrrtPacketDataPayload
*
payload
=
packet
->
payload
;
// TODO: should lock here !
payload
->
group_round_trip_time
=
(
uint16_t
)
(
sock_ptr
->
csi
.
rttMean
/
1000
);
PrrtPacket
*
packetToSend
=
PrrtPacket_copy
(
packet
);
send_packet
(
sock_ptr
,
packetToSend
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment