[JMF] Problème de merge de DataSources
Bonjour Tous,
Dans mon projet, je veux faire un "merge" pour 2 data source on un seul steam. j'ai bien reçu les deux streaming. j'ai 2 classes dont j'ai reçoit bien les streaming.
Première classe: ici je reçois le 1er stream
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| public void update(ReceiveStreamEvent evt) {
RTPManager mgr = (RTPManager)evt.getSource();
Participant participant = evt.getParticipant(); // could be null.
ReceiveStream stream = evt.getReceiveStream(); // could be null.
if (evt instanceof RemotePayloadChangeEvent) {
System.err.println(" - Received an RTP PayloadChangeEvent.");
System.err.println("Sorry, cannot handle payload change.");
}
else if (evt instanceof NewReceiveStreamEvent) {
try {
stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
DataSource ds = stream.getDataSource();
// Find out the formats.
RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
if (ctl != null){
System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
} else
System.err.println(" - Recevied new RTP stream");
if (participant == null)
System.err.println(" The sender of this stream had yet to be identified.");
else {
System.err.println(" The stream comes from: " + participant.getCNAME());
}
// create a player by passing datasource to the Media Manager
ReceiveStream rs = evt.getReceiveStream();
*main.sources[0]=rs.getDataSource();* |
2ème classe: la même que la première classe
main.sources[1]=rs.getDataSource();
Merge Sources
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| OutputSource = Manager.createMergingDataSource(main.Sources) ;
//Adding formats
Format formats[] = new Format[1];
formats[0] = af[0];
ContentDescriptor contentDescriptor = new ContentDescriptor(FileTypeDescriptor.MIXED);
ProcessorModel processorModel = new ProcessorModel(OutputSource, formats, null);
Processor processor;
try {
processor = Manager.createRealizedProcessor(processorModel);
processor.start();
} catch (NoProcessorException e) {
e.printStackTrace();
} |
Ici, dans le OutputSource j'entends juste le premier streaming (main.Sources[0]) et non pas le mixed Stream.
Et lorsque j'inverse et que je mets dans la 2eme classe (main.sources[0]=rs.getDataSource()), là j'entends aussi seulement un seul streaming mais c'est le deuxième cette fois-ci.
Merci de votre aide