rtp.c
int sanitised_source_rate_information(uint32_t *frames, uint64_t *time, rtsp_conn_info *conn) {
  int result = 1;
  uint32_t fs = conn->input_rate;
  *frames = fs;
  uint64_t one_fp = (uint64_t)(0x100000000); // one second in fp form
  *time = one_fp;
  if ((conn->initial_reference_time) && (conn->initial_reference_timestamp)) {
    //    uint32_t local_frames = conn->reference_timestamp - conn->initial_reference_timestamp;
    uint32_t local_frames =
        modulo_32_offset(conn->initial_reference_timestamp, conn->reference_timestamp);
    uint64_t local_time = conn->remote_reference_timestamp_time - conn->initial_reference_time;
    if ((local_frames == 0) || (local_time == 0) || (use_nominal_rate)) {
      result = 1;
    } else {
      double calculated_frame_rate = conn->input_rate;
      if (local_time)
        calculated_frame_rate = ((1.0 * local_frames) / local_time) * one_fp;
      else
        debug(1, "sanitised_source_rate_information: local_time is zero");
      if ((local_time == 0) || ((calculated_frame_rate / conn->input_rate) > 1.002) ||
          ((calculated_frame_rate / conn->input_rate) < 0.998)) {
        debug(3, "input frame rate out of bounds at %.2f fps.", calculated_frame_rate);
        result = 1;
      } else {
        *frames = local_frames;
        *time = local_time;
        result = 0;
      }
    }
  }
  return result;
}
// specify whether to use the nominal input rate, usually 44100 fps
specify whether to use the nominal input rate, usually 44100 fps
specify whether to use the nominal input rate usually 44100 fps
int sanitised_source_rate_information(uint32_t *frames, uint64_t *time, rtsp_conn_info *conn) {
  int result = 1;
  uint32_t fs = conn->input_rate;
  *frames = fs;
  uint64_t one_fp = (uint64_t)(0x100000000); 
  *time = one_fp;
  if ((conn->initial_reference_time) && (conn->initial_reference_timestamp)) {
    uint32_t local_frames =
        modulo_32_offset(conn->initial_reference_timestamp, conn->reference_timestamp);
    uint64_t local_time = conn->remote_reference_timestamp_time - conn->initial_reference_time;
    if ((local_frames == 0) || (local_time == 0) || (use_nominal_rate)) {
      result = 1;
    } else {
      double calculated_frame_rate = conn->input_rate;
      if (local_time)
        calculated_frame_rate = ((1.0 * local_frames) / local_time) * one_fp;
      else
        debug(1, "sanitised_source_rate_information: local_time is zero");
      if ((local_time == 0) || ((calculated_frame_rate / conn->input_rate) > 1.002) ||
          ((calculated_frame_rate / conn->input_rate) < 0.998)) {
        debug(3, "input frame rate out of bounds at %.2f fps.", calculated_frame_rate);
        result = 1;
      } else {
        *frames = local_frames;
        *time = local_time;
        result = 0;
      }
    }
  }
  return result;
}
int sanitised_source_rate_information ( uint32_t * frames , uint64_t * time , rtsp_conn_info * conn ) { int result = 1 ; uint32_t fs = conn -> input_rate ; * frames = fs ; uint64_t one_fp = ( uint64_t ) ( 0x100000000 ) ; * time = one_fp ; if ( ( conn -> initial_reference_time ) && ( conn -> initial_reference_timestamp ) ) { uint32_t local_frames = modulo_32_offset ( conn -> initial_reference_timestamp , conn -> reference_timestamp ) ; uint64_t local_time = conn -> remote_reference_timestamp_time - conn -> initial_reference_time ; if ( ( local_frames == 0 ) || ( local_time == 0 ) || ( use_nominal_rate ) ) { result = 1 ; } else { double calculated_frame_rate = conn -> input_rate ; if ( local_time ) calculated_frame_rate = ( ( 1.0 * local_frames ) / local_time ) * one_fp ; else debug ( 1 , " " ) ; if ( ( local_time == 0 ) || ( ( calculated_frame_rate / conn -> input_rate ) > 1.002 ) || ( ( calculated_frame_rate / conn -> input_rate ) < 0.998 ) ) { debug ( 3 , " " , calculated_frame_rate ) ; result = 1 ; } else { * frames = local_frames ; * time = local_time ; result = 0 ; } } } return result ; }
specify whether to use the nominal input rate, usually 44100 fps
specify whether to use the nominal input rate usually 44100 fps
// one second in fp form //    uint32_t local_frames = conn->reference_timestamp - conn->initial_reference_timestamp;