Is it possible to set the chunk/segment size per stream (instead of per application in the Application.xml)? I’ve looked into the onLiveStreamPacketizerInit(ILiveStreamPacketizer liveStreamPacketizer, String streamName) method, but there’s no obvious property or method in the ILiveStreamPacketizer for that.
You can do it, probably not as you might expect
public void onAppStart(IApplicationInstance appInstance) {
appInstance.addLiveStreamPacketizerListener(new LiveActionNotify(appInstance));
}
class LiveActionNotify implements ILiveStreamPacketizerActionNotify
{
private IApplicationInstance appInstance = null;
public LiveActionNotify(IApplicationInstance appInstance)
{
this.appInstance = appInstance;
}
public void onLiveStreamPacketizerCreate(ILiveStreamPacketizer liveStreamPacketizer, String streamName)
{
while (true)
{
if (!(liveStreamPacketizer instanceof LiveStreamPacketizerCupertino))
break;
LiveStreamPacketizerCupertino cupertinoPacketizer = (LiveStreamPacketizerCupertino)liveStreamPacketizer;
if (streamName.equals("Stream1") )
{
cupertinoPacketizer.getProperties().setProperty("cupertinoChunkDurationTarget", 2000);
}
if (streamName.equals("Stream2") )
{
cupertinoPacketizer.getProperties().setProperty("cupertinoChunkDurationTarget", 10000);
}
if (streamName.equals("Stream3") )
{
cupertinoPacketizer.getProperties().setProperty("cupertinoChunkDurationTarget", 6000);
}
break;
}
}
public void onLiveStreamPacketizerDestroy(ILiveStreamPacketizer liveStreamPacketizer)
{
}
public void onLiveStreamPacketizerInit(ILiveStreamPacketizer liveStreamPacketizer, String streamName)
{
}
}
I have tested it and I get
INFO stream publish Stream1 -
INFO stream create - -
INFO stream publish Stream2 -
INFO stream create - -
INFO stream publish Stream3 -
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream2]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream3]: chunkDurationTarget: 6000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream1]: chunkDurationTarget: 2000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream3]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream2]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream3]: playlistChunkCount:3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream1]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream2]: playlistChunkCount:3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/Stream1]: playlistChunkCount:3
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/Stream2]: Create live stream packetizer: cupertinostreamingpacketizer:Stream2
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/Stream1]: Create live stream packetizer: cupertinostreamingpacketizer:Stream1
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/Stream3]: Create live stream packetizer: cupertinostreamingpacketizer:Stream3
So it does appear to work, however certainly something at present which is not tested.
Andrew.