Add source rate calculation based on source frame and timing information, calculated from start of play session.
This commit is contained in:
@@ -1785,9 +1785,10 @@ void *player_thread_func(void *arg) {
|
||||
"min DAC queue size, "
|
||||
"min buffer occupancy, "
|
||||
"max buffer occupancy, "
|
||||
"input frames per second, "
|
||||
"source frames per second, "
|
||||
"average input frames per second, "
|
||||
"output frames per second, "
|
||||
"drift client vs local clock in ppm");
|
||||
"client:local clock drift in ppm");
|
||||
} else {
|
||||
inform("sync error in milliseconds, "
|
||||
"total packets, "
|
||||
@@ -2414,7 +2415,8 @@ void *player_thread_func(void *arg) {
|
||||
"%*lli," /* min DAC queue size */
|
||||
"%*d," /* min buffer occupancy */
|
||||
"%*d," /* max buffer occupancy */
|
||||
"%*.2f," /* input frame rate */
|
||||
"%*.2f," /* remote frame rate */
|
||||
"%*.2f," /* actual (average) input frame rate */
|
||||
"%*.2f," /* output frame rate */
|
||||
"%*.2f," /* output frame rate */
|
||||
"%*d", /* sample count */
|
||||
@@ -2426,7 +2428,12 @@ void *player_thread_func(void *arg) {
|
||||
12, play_number, 7, conn->missing_packets, 7, conn->late_packets, 7,
|
||||
conn->too_late_packets, 7, conn->resend_requests, 7,
|
||||
minimum_dac_queue_size, 5, minimum_buffer_occupancy, 5,
|
||||
maximum_buffer_occupancy, 11, conn->input_frame_rate, 11, conn->frame_rate , 10, (1.0-conn->local_to_remote_time_gradient)*1000000, 6, conn->local_to_remote_time_gradient_sample_count);
|
||||
maximum_buffer_occupancy,
|
||||
11, conn->remote_frame_rate,
|
||||
11, conn->input_frame_rate,
|
||||
11, conn->frame_rate ,
|
||||
10, (1.0-conn->local_to_remote_time_gradient)*1000000,
|
||||
6, conn->local_to_remote_time_gradient_sample_count);
|
||||
} else {
|
||||
inform("%*.2f," /* Sync error in milliseconds */
|
||||
"%*d," /* total packets */
|
||||
|
||||
@@ -191,6 +191,11 @@ typedef struct {
|
||||
uint64_t remote_reference_timestamp_time;
|
||||
|
||||
|
||||
// used as the initials values for calculating the rate at which the source thinks it's sending frames
|
||||
int64_t initial_reference_timestamp;
|
||||
uint64_t initial_reference_time;
|
||||
double remote_frame_rate;
|
||||
|
||||
// the ratio of the following should give us the operating rate, nominally 44,100
|
||||
int64_t reference_to_previous_frame_difference;
|
||||
uint64_t reference_to_previous_time_difference;
|
||||
|
||||
@@ -356,6 +356,17 @@ void *rtp_control_receiver(void *arg) {
|
||||
}
|
||||
|
||||
debug_mutex_lock(&conn->reference_time_mutex, 1000, 1);
|
||||
|
||||
if (conn->initial_reference_time==0) {
|
||||
conn->initial_reference_time = remote_time_of_sync;
|
||||
conn->initial_reference_timestamp = sync_rtp_timestamp;
|
||||
} else {
|
||||
uint64_t remote_frame_time_interval = conn->remote_reference_timestamp_time - conn->initial_reference_time; // here, this should never be zero
|
||||
if (remote_frame_time_interval) {
|
||||
conn->remote_frame_rate = (1.0 * (conn->reference_timestamp - conn->initial_reference_timestamp)) / remote_frame_time_interval; // an IEEE double calculation with two 64-bit integers
|
||||
conn->remote_frame_rate = conn->remote_frame_rate * (uint64_t)0x100000000; // this should just change the [binary] exponent in the IEEE FP representation; the mantissa should be unaffected.
|
||||
}
|
||||
}
|
||||
|
||||
// this is for debugging
|
||||
uint64_t old_remote_reference_time = conn->remote_reference_timestamp_time;
|
||||
|
||||
Reference in New Issue
Block a user