Skip to content
Snippets Groups Projects
Commit cd8c1174 authored by Damian Minkov's avatar Damian Minkov
Browse files

Handles payload type change event in receive streams.

parent 6b441e01
No related branches found
No related tags found
No related merge requests found
......@@ -2400,6 +2400,43 @@ else if (event instanceof TimeoutEvent)
}
}
}
else if (event instanceof RemotePayloadChangeEvent)
{
ReceiveStream receiveStream = event.getReceiveStream();
if(receiveStream != null)
{
MediaDeviceSession deviceSession = getDeviceSession();
if (deviceSession != null)
{
TranscodingDataSource transcodingDataSource
= deviceSession.getTranscodingDataSource(receiveStream);
// we receive packets, streams are active
// if processor in transcoding DataSource is running
// we need to recreate it by disconnect, connect
// and starting again the DataSource
try
{
transcodingDataSource.disconnect();
transcodingDataSource.connect();
transcodingDataSource.start();
// as output streams of the DataSource
// are recreated we need to update
// mixers and everything that are using them
deviceSession.playbackDataSourceChanged(
receiveStream.getDataSource());
}
catch(IOException e)
{
logger.error("Error re-creating processor in " +
"transcoding DataSource", e);
}
}
}
}
}
/**
......
......@@ -107,6 +107,16 @@ public void addInputDataSource(DataSource inputDataSource)
audioMixer.addInputDataSource(inputDataSource, this);
}
/**
* The input <tt>DataSource</tt> has been updated.
* @param inputDataSource the <tt>DataSource</tt> that was updated.
*/
public void updateInputDataSource(DataSource inputDataSource)
{
// just update the input streams
audioMixer.getOutputStream();
}
/**
* Implements {@link DataSource#connect()}. Lets the <tt>AudioMixer</tt>
* know that one of its output <tt>PushBufferDataSources</tt> has been
......
......@@ -1017,6 +1017,36 @@ protected void playbackDataSourceRemoved(DataSource playbackDataSource)
playbackDataSource);
}
/**
* Notifies this <tt>MediaDeviceSession</tt> that a <tt>DataSource</tt>
* has been updated.
*
* @param playbackDataSource the <tt>DataSource</tt> which has been
* updated.
* @see MediaDeviceSession#playbackDataSourceUpdated(DataSource)
*/
@Override
protected void playbackDataSourceUpdated(DataSource playbackDataSource)
{
super.playbackDataSourceUpdated(playbackDataSource);
DataSource captureDevice = getCaptureDevice();
/*
* Unwrap wrappers of the captureDevice until
* AudioMixingPushBufferDataSource is found.
*/
if (captureDevice instanceof PushBufferDataSourceDelegate<?>)
captureDevice
= ((PushBufferDataSourceDelegate<?>) captureDevice)
.getDataSource();
if (captureDevice instanceof AudioMixingPushBufferDataSource)
{
((AudioMixingPushBufferDataSource) captureDevice)
.updateInputDataSource(playbackDataSource);
}
}
/**
* The method relays <tt>PropertyChangeEvent</tt>s indicating a change
* in the SSRC_LIST in the encapsulated mixer device so that the
......
......@@ -1172,6 +1172,29 @@ protected void playbackDataSourceRemoved(DataSource playbackDataSource)
{
}
/**
* Notifies this <tt>MediaDeviceSession</tt> that a <tt>DataSource</tt> has
* been changed on the represented <tt>MediaDevice</tt>.
*
* @param playbackDataSource the <tt>DataSource</tt> which has been added
* for playback on the represented <tt>MediaDevice</tt>
*/
protected void playbackDataSourceUpdated(DataSource playbackDataSource)
{
}
/**
* Notifies this <tt>MediaDeviceSession</tt> that a <tt>DataSource</tt> has
* been changed on the represented <tt>MediaDevice</tt>.
*
* @param playbackDataSource the <tt>DataSource</tt> which has been added
* for playback on the represented <tt>MediaDevice</tt>
*/
public void playbackDataSourceChanged(DataSource playbackDataSource)
{
playbackDataSourceUpdated(playbackDataSource);
}
/**
* Notifies this instance that a specific <tt>Player</tt> of remote content
* has generated a <tt>ConfigureCompleteEvent</tt>. Allows extenders to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment