Implements a complex sample delay buffer integrated into the tuner

channel manager so that channel source requests can have a start
timestamp specified and the channel can be preloaded with samples from
the delay buffer.  If no timestamp is specified, current time is assumed.

This feature requires corresponding updates to any decoder that wishes
to implement the timestamped sample preloading functionality.
This commit is contained in:
Denny
2018-09-09 08:46:21 -04:00
parent bb0bcd3198
commit 570321da3e
21 changed files with 632 additions and 98 deletions

View File

@@ -56,20 +56,28 @@ public class SourceEvent
/**
* Private constructor. Use the static constructor methods to create an event.
*/
private SourceEvent(Event event, Number value, String eventDescription)
private SourceEvent(Event event, Source source, Number value, String eventDescription)
{
mEvent = event;
mSource = source;
mValue = value;
mEventDescription = eventDescription;
}
/**
* Private constructor. Use the static constructor methods to create an event.
*/
private SourceEvent(Event event, Number value, String eventDescription)
{
this(event, null, value, eventDescription);
}
/**
* Private constructor. Use the static constructor methods to create an event.
*/
private SourceEvent(Event event, Number value)
{
mEvent = event;
mValue = value;
this(event, value, null);
}
/**
@@ -77,8 +85,12 @@ public class SourceEvent
*/
private SourceEvent(Event event, Source source)
{
mEvent = event;
mSource = source;
this(event, source, 0);
}
private SourceEvent(Event event, Source source, Number value)
{
this(event, source, value, null);
}
/**
@@ -283,11 +295,22 @@ public class SourceEvent
}
/**
* Creates a new start sample stream request event
* Creates a new start sample stream request event. This method uses the current system time in
* milliseconds as the requested sample start time.
*/
public static SourceEvent startSampleStreamRequest(Source source)
{
return new SourceEvent(Event.REQUEST_START_SAMPLE_STREAM, source);
return startSampleStreamRequest(source, System.currentTimeMillis());
}
/**
* Creates a new start sample stream request event and requests that samples (when available) for the
* specified timestamp be pre-loaded into the source. The timestamp only applies for sources that incorporate
* a sample delay buffer.
*/
public static SourceEvent startSampleStreamRequest(Source source, long timestamp)
{
return new SourceEvent(Event.REQUEST_START_SAMPLE_STREAM, source, timestamp);
}
/**
@@ -299,7 +322,7 @@ public class SourceEvent
}
/**
* Creates a new stop sample stream request event
* Creates a new stop sample stream notification event
*/
public static SourceEvent stopSampleStreamNotification(Source source)
{