]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Sometimes the output_rtptime_mask seems to be calculated in 32-bit arithmetic (?...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 23 Jun 2021 10:21:32 +0000 (11:21 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 23 Jun 2021 10:21:32 +0000 (11:21 +0100)
player.c

index cd09bf8be321f227be2d72b333601a5dea22caed..1d12e34c8c86ce176b278e15157f94707acda309 100644 (file)
--- a/player.c
+++ b/player.c
@@ -1807,7 +1807,12 @@ void *player_thread_func(void *arg) {
 //  debug(1, "Output sample ratio is %d.", conn->output_sample_ratio);
 //  debug(1, "Output output_rtptime_sign_bit: %d.", output_rtptime_sign_bit);
 
-  conn->max_frame_size_change =
+  int64_t output_rtptime_mask = 1;
+  output_rtptime_mask = output_rtptime_mask << (output_rtptime_sign_bit + 1);
+  output_rtptime_mask = output_rtptime_mask - 1;
+  debug(3,"output_rtptime_mask is %" PRIx64 ".", output_rtptime_mask);
+  
+    conn->max_frame_size_change =
       1 * conn->output_sample_ratio; // we add or subtract one frame at the nominal
                                      // rate, multiply it by the frame ratio.
                                      // but, on some occasions, more than one frame could be added
@@ -2331,7 +2336,7 @@ void *player_thread_func(void *arg) {
             // current_delay is denominated in the frame rate of the outgoing stream
             int64_t will_be_frame = inframe->given_timestamp;
             will_be_frame = will_be_frame * conn->output_sample_ratio;
-            will_be_frame = (will_be_frame - current_delay) & ((1 << (output_rtptime_sign_bit + 1)) - 1);
+            will_be_frame = (will_be_frame - current_delay) & output_rtptime_mask;
 
             sync_error =
                 SIGNEX(should_be_frame - will_be_frame, output_rtptime_sign_bit) ; // all int64_t