Skip to content

Commit

Permalink
#1360 Resolves issue with Polyphase channelizer and decoded message t…
Browse files Browse the repository at this point in the history
…imestamps for P25 and other protocols. (#1361)

Co-authored-by: Dennis Sheirer <[email protected]>
  • Loading branch information
DSheirer and Dennis Sheirer authored Dec 17, 2022
1 parent 24f4c22 commit 9af593a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
import io.github.dsheirer.source.ISourceEventListener;
import io.github.dsheirer.source.SourceEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractComplexPolyphaseChannelizer implements Listener<InterleavedComplexSamples>, ISourceEventListener
{
Expand All @@ -38,6 +37,7 @@ public abstract class AbstractComplexPolyphaseChannelizer implements Listener<In
private int mChannelCount;
private int mSubChannelCount;
private double mChannelSampleRate;
protected long mCurrentSamplesTimestamp;

/**
* Complex sample polyphase channelizer
Expand Down Expand Up @@ -106,7 +106,7 @@ protected void dispatch(List<float[]> channelResultsList)
{
for(PolyphaseChannelSource channel : mChannels)
{
channel.receiveChannelResults(channelResultsList);
channel.receiveChannelResults(channelResultsList, mCurrentSamplesTimestamp);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
import io.github.dsheirer.util.Dispatcher;
import org.apache.commons.math3.util.FastMath;
import org.jtransforms.fft.FloatFFT_1D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.math3.util.FastMath;
import org.jtransforms.fft.FloatFFT_1D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Non-Maximally Decimated Polyphase Filter Bank (NMDPFB) channelizer that divides the input baseband complex sample
Expand Down Expand Up @@ -193,7 +192,8 @@ public void setRates(double sampleRate, int channelCount)
@Override
public void receive(InterleavedComplexSamples complexSamples)
{
//TODO: how do we pass the timestamp onto the sample assemblers?
mCurrentSamplesTimestamp = complexSamples.timestamp();

float[] samples = complexSamples.samples();

int samplesPointer = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
private double mChannelSampleRate;
private long mIndexCenterFrequency;
private long mChannelFrequencyCorrection;
private long mCurrentSamplesTimestamp;
private ReentrantLock mOutputProcessorLock = new ReentrantLock();

/**
Expand Down Expand Up @@ -107,7 +106,6 @@ public void setListener(final Listener<ComplexSamples> listener)
public void receive(ComplexSamples complexSamples)
{
mStreamHeartbeatProcessor.receive(complexSamples);
mCurrentSamplesTimestamp = complexSamples.timestamp();
}

/**
Expand Down Expand Up @@ -215,16 +213,17 @@ public void updateOutputProcessor(ChannelCalculator channelCalculator, Synthesis
* channel aggregation, and dispatch the results to the downstream sample listener/consumer.
*
* @param channelResultsList containing a list of polyphase channelizer output arrays.
* @param currentSamplesTimestamp for the samples
*/
public void receiveChannelResults(List<float[]> channelResultsList)
public void receiveChannelResults(List<float[]> channelResultsList, long currentSamplesTimestamp)
{
mOutputProcessorLock.lock();

try
{
if(mPolyphaseChannelOutputProcessor != null)
{
mPolyphaseChannelOutputProcessor.receiveChannelResults(channelResultsList, mCurrentSamplesTimestamp);
mPolyphaseChannelOutputProcessor.receiveChannelResults(channelResultsList, currentSamplesTimestamp);
}
}
finally
Expand Down

0 comments on commit 9af593a

Please sign in to comment.