bonjour a tous. Je suis en train de développer un labo de langue. Pource faire j'utilise jmf afin d'envoyer et de recevoir des flux audio sur ip.
J'utilise la source de sun AVTransmit2 pour envoyer que j'ai un peu modifier afin d'envoyer des flux a plusieurs personne en meme temps.
Ici j'ai cree un boucle afin d'ajouter des destination au rtpmanager.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    private String createTransmitter() {
 
	// Cheated.  Should have checked the type.
	PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
	PushBufferStream pbss[] = pbds.getStreams();
 
	rtpMgrs = new RTPManager[pbss.length];
	SessionAddress localAddr;
	InetAddress ipAddr = null;
	SessionAddress destAddr = null;
	SendStream sendStream;
	int port;
	SourceDescription srcDesList[];
 
	for (int i = 0; i < pbss.length; i++) {
	    try {
		rtpMgrs[i] = RTPManager.newInstance();	    
 
		// The local session address will be created on the
		// same port as the the target port. This is necessary
		// if you use AVTransmit2 in conjunction with JMStudio.
		// JMStudio assumes -  in a unicast session - that the
		// transmitter transmits from the same port it is receiving
		// on and sends RTCP Receiver Reports back to this port of
		// the transmitting host.
		port = portBase + 2*i;
		localAddr = new SessionAddress( InetAddress.getLocalHost(),port);
		System.out.println("local "+localAddr);
 
		rtpMgrs[i].initialize( localAddr);
 
         //C ICI QUE COMMENCE MES MODIFS
 
			for (int adr = 0; adr < ipAddress.length; adr++)
			{	
				try{
					ipAddr = InetAddress.getByName(ipAddress[adr].toString());
				}catch(Exception e){System.out.println(e);}
 
				port = portBase + 2*i;
 
				try{
					destAddr = new SessionAddress( ipAddr, port);
				}catch(Exception e){System.out.println(e);}
 
 
				rtpMgrs[i].addTarget( destAddr);
 
				System.err.println( "Created RTP session: " + ipAddress[adr].toString() + " " + port);
 
				sendStream = rtpMgrs[i].createSendStream(dataOutput, i);		
				sendStream.start();
 
    //ET ICI QUE CA SE TERMINE
 
			}
	    } catch (Exception  e) {
		return e.getMessage();
	    }
	}
 
	return null;
    }

ceci fonctionne sans problème.
C'est lors de la fermeture des flux et de la destruction du rtpManager que ca coince!
ici je n'ai pas modifie de code. Juste le try qui me retourne un nullPointerException.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    public void stop() {
	synchronized (this) {
	    if (processor != null) {
		processor.stop();
		processor.close();
		processor = null;
		for (int i = 0; i < rtpMgrs.length; i++) {
			rtpMgrs[i].removeTargets( "Connexion fermée.");
			try{
				rtpMgrs[i].dispose();
			}catch(Exception e){System.out.println(e);}
		}
	    }
	}
    }
Voila j'ai verifier plusieur fois le code, je ne pense pas avoir de nouvelle instanciation du rtpManager....Mais en meme temps je suis un codeur .net a la base. j'ai appris jmf et java en codant ca!!!!
juste comme ca voici le main!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
...
private String[] tabIp = {"127.0.0.1","127.0.0.2","127.0.0.3"};
...
 
if ( src.equals(vue.getJButtonTransmettre()) ){
			at = new AVTransmit2(new MediaLocator("javasound://44100"), tabIp, port, fmt);
 
			// Start the transmission
			String result = at.start();
 
			// result will be non-null if there was an error. The return
			// value is a String describing the possible error. Print it.
			if (result != null) {
			    System.err.println("Error : " + result);
			}
			else{
				vue.getJButtonRecevoir().setEnabled(false);
				vue.getJTextFieldEtat().setText("Transmition");
			}
 
			return;
		}
...
if ( src.equals(vue.getJButtonStop()) ){
 
			// Stop the transmission
			at.stop();
			System.err.println("...transmission ended.");
...
Merci de votre aide.