- Timestamp:
- 04/14/09 18:19:59 (3 years ago)
- Parents:
- 3b91569fdc9315612c62458ca02a2ef74b7c7970
- Children:
- f260f21876d739831315b71cf713e64cfbab9660
- git-committer:
- Robin Gareus <robin@gareus.org> / 2009-04-14T20:19:59Z+0200
- Files:
-
- 1 modified
-
src/org/red5/rg/recorder/Application.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/org/red5/rg/recorder/Application.java
rcb749e0 re89e3a9 17 17 import org.slf4j.Logger; 18 18 19 import java.util.HashMap; 20 import java.util.Iterator; 21 19 22 public class Application extends ApplicationAdapter { 20 23 21 24 private static Logger log = Red5LoggerFactory.getLogger(Application.class, "recorder"); 25 private HashMap streams = new HashMap(); 22 26 23 private IScope appScope;24 25 27 { 26 28 log.info("recorder created"); … … 28 30 } 29 31 32 private boolean checkPass(String u, String p) { 33 if (u.equals("4dc84c9279d0fcaa793eecfbc544cdbe7ea5f6e4") 34 && p.equals("f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6")) 35 return true; 36 return false; 37 } 38 30 39 @Override 31 40 public boolean appStart(IScope app) { 32 41 log.info("recorder appStart"); 33 System.out.println("recorder appStart"); 34 appScope = app; 42 // System.out.println("recorder appStart"); 35 43 return true; 36 44 } 37 45 38 46 39 private boolean checkPass(String u, String p) {40 if (u.equals("secret")) return true;41 return false;42 }43 44 47 @Override 45 48 public boolean appConnect(IConnection conn, Object[] params) { 46 log.info("recorder appConnect" + conn.getClient().getId() ); 49 String id = conn.getClient().getId(); 50 log.info("recorder appConnect: " + id + "(" + streams.get("file_"+id)+ ")"); 51 /* 52 log.info("recorder host=" + conn.getHost()); 53 log.info("recorder remote=" + conn.getRemoteAddress()); 54 log.info("recorder clientAtt=" + conn.getClient().getAttributeNames()); 55 log.info("recorder connectParams=" + conn.getConnectParams().toString()); 56 // log.info("recorder file=" + conn.getPublishedName()); 57 log.info("recorder file=" + params[2].toString()); 58 */ 59 60 streams.put("file_"+id,params[2].toString()); 61 streams.put("host_"+id,conn.getRemoteAddress()); 62 // streams.put("host_"+id,conn.getHost()); 63 47 64 // Trigger calling of "onBWDone", required for some FLV players 48 65 measureBandwidth(conn); 49 66 if (conn instanceof IStreamCapableConnection) { 50 67 IStreamCapableConnection streamConn = (IStreamCapableConnection) conn; 68 // log.info("recorder path=" + streamConn.getStreamById(0).getPublishedName()); 51 69 SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig(); 52 70 bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] = … … 66 84 } 67 85 68 /** {@inheritDoc} */69 86 @Override 70 87 public void appDisconnect(IConnection conn) { 71 log.info("recorder appDisconnect" + conn.getClient().getId() ); 88 String id = conn.getClient().getId(); 89 log.info("recorder appDisconnect: " + id + "(" + streams.get("file_"+id)+ ")"); 90 72 91 try{ 73 Runtime.getRuntime().exec("/ tmp/test.sh");92 Runtime.getRuntime().exec("/usr/local/bin/cfvb-transcode.sh "+streams.get("file_"+id)+" "+streams.get("host_"+id)); 74 93 } catch (IOException e) {} 94 95 streams.remove("file_"+id); 96 streams.remove("host_"+id); 75 97 super.appDisconnect(conn); 76 98 }
