so I am fairly new to this SDR and dsp thing, I am working on a project that calculates the ppm and adjusts the offset, now I kinda got the idea of how to calculate the ppm after going through the rtl_test source code, but for that, I need the number of samples in a time frame( as in frequency offset, the sample rate changes a tad bit). Now I am not sure how to approach that, can someone guide me on that? I see there is some rtl_read_async function in c that probably has a parameter that is passed by reference and returns the number of samples received, but I am not sure how to use it as I can't seem to find any documentation.
The real number of samples from an RTL-SDR is not available via the USB interface. The RTL2832U chip samples at 28.8 Msps, but then mixes and downsamples the internal samples to lower rate IQ samples at from 240k to about 3 Msps, to allow transport over its slower USB 2.0 bus. The front-end R820T tuner can first downconvert VHF and UHF signal to a low HF IF frequency for sampling. Or HF under 14.4 MHz can be directly sampled by the RTL chip on some models of the device (V3, and clones). Undersampling is possible for higher HF.
Normally the PPM (parts per million frequency calibration offset) is determined by tuning the SDR to a commercial or standards transmitter at a known frequency (WWV, et.al.), or a GPS disciplined oscillator, and zero beating to measure any indicated offset from the known carrier frequency.