[Red5devs] Fwd: [Red5commits] [1132] Added some things to make flv player work. getStreamLength and onBWDone. Added s

John Grden neoriley at gmail.com
Mon Jul 10 00:26:35 EDT 2006


ok, cool, i'll see if I can see anything specific with xray at runtime

Thanks Luke

JG

On 7/10/06, Luke Hubbard <luke at codegent.com> wrote:
>
> Yes and no. :)
>
> The MM component doesnt seem to work. The video does stream from R5
> but the ui doenst show and you dont see the video. So the netstream is
> working but the ui isnt.
>
> The Peldi one worked. Although, I did have some small problems. It
> seems like we are too fast and sometimes the ui hasnt finished init
> before the stream starts. This causes it to fail, but wouldnt be a
> problem if you are online. Give it a try it works for me.
>
> I will work on figuring out why the MM one doenst show the ui. Im
> guessing it might be some specific metadata its expecting.
>
> - Luke
>
> On 7/10/06, John Grden <neoriley at gmail.com> wrote:
> > ARe you saying that the FLVPlayback component now works with Red5?
> >
> >
> > ---------- Forwarded message ----------
> > From: lhubbard < luke at codegent.com>
> > Date: Jul 9, 2006 3:40 PM
> > Subject: [Red5commits] [1132] Added some things to make flv player work.
> > getStreamLength and onBWDone. Added s
> > To: red5commits at osflash.org
> >
> > Added some things to make flv player work. getStreamLength and onBWDone.
> > Added serializer options. Added clear pings.
> >
> >
> > Timestamp: 07/10/06 05:34:08 (less than one hour ago)
> > Change: 1132
> >  Author: lhubbard
> >
> > Files (see diff or trac for details):
> > java/io/trunk/src/org/red5/io/ITagReader.java
> > java/io/trunk/src/org/red5/io/flv/impl/FLVReader.java
> > java/io/trunk/src/org/red5/io/mp3/impl/MP3Reader.java
> > java/io/trunk/src/org/red5/io/object/Serializer.java
> > java/io/trunk/src/org/red5/io/object/SerializerOpts.java
> > java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
> > java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
> > java/server/trunk/src/org/red5/server/net/rtmp/RTMPHandler.java
> >
> java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
> >
> java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java
> > java/server/trunk/src/org/red5/server/net/rtmp/event/Ping.java
> > java/server/trunk/src/org/red5/server/net/rtmp/status/Status.java
> > java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObject.java
> >
> java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObjectService.java
> > java/server/trunk/src/org/red5/server/stream/IProviderService.java
> >
> java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java
> > java/server/trunk/src/org/red5/server/stream/ProviderService.java
> >
> >
> > Trac:
> > http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1132
> >
> > Index:
> > /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
> > (revision 1092)
> > +++
> > /java/server/trunk/src/org/red5/server/adapter/ApplicationAdapter.java
> > (revision 1132)
> > @@ -24,4 +24,6 @@
> >  import static org.red5.server.api.ScopeUtils.isRoom;
> >
> > +import java.io.File;
> > +import java.io.IOException;
> >  import java.util.Date;
> >  import java.util.Iterator;
> > @@ -30,7 +32,13 @@
> >  import org.apache.commons.logging.Log;
> >  import org.apache.commons.logging.LogFactory;
> > +import org.red5.io.IStreamableFile;
> > +import org.red5.io.IStreamableFileFactory;
> > +import org.red5.io.IStreamableFileService ;
> > +import org.red5.io.ITagReader;
> > +import org.red5.io.StreamableFileFactory;
> >  import org.red5.server.api.IClient;
> >  import org.red5.server.api.IConnection;
> >  import org.red5.server.api.IScope;
> > +import org.red5.server.api.ScopeUtils ;
> >  import org.red5.server.api.scheduling.IScheduledJob;
> >  import org.red5.server.api.scheduling.ISchedulingService;
> > @@ -79,9 +87,17 @@
> >
> >         public boolean connect(IConnection conn, IScope scope, Object[]
> > params) {
> > +               /*
> > +               try {
> > +                       Thread.currentThread().sleep(3000);
> > +               } catch (InterruptedException e) {
> > +                       // TODO Auto-generated catch block
> > +                       e.printStackTrace();
> > +               }*/
> >                 if (!super.connect(conn, scope, params))
> >                         return false;
> > -               if(isApp(scope)) return appConnect(conn, params);
> > -               else if(isRoom(scope)) return roomConnect(conn, params);
> > -               else return false;
> > +               boolean success = false;
> > +               if(isApp(scope)) success = appConnect(conn, params);
> > +               else if(isRoom(scope)) success = roomConnect(conn,
> params);
> > +               return success;
> >         }
> >
> > @@ -273,3 +289,29 @@
> >         }
> >
> > +       // NOTE: Method added to get flv player to work.
> > +       public double getStreamLength(String name){
> > +               IProviderService provider = (IProviderService)
> > getScopeService(scope, IProviderService.KEY, ProviderService.class);
> > +               File file = provider.getVODProviderFile(scope, name);
> > +               if(file == null) return 0;
> > +
> > +               double duration = 0;
> > +
> > +               IStreamableFileFactory factory =
> (IStreamableFileFactory)
> > ScopeUtils.getScopeService (scope, IStreamableFileFactory.KEY,
> > StreamableFileFactory.class);
> > +               IStreamableFileService service = factory.getService
> (file);
> > +               if (service == null) {
> > +                       log.error ("No service found for " +
> > file.getAbsolutePath());
> > +                       return 0;
> > +               }
> > +               try {
> > +                       IStreamableFile streamFile =
> > service.getStreamableFile (file);
> > +                       ITagReader reader = streamFile.getReader();
> > +                       duration = reader.getDuration() / 1000;
> > +                       reader.close();
> > +               } catch (IOException e) {
> > +                       log.error("error read stream file " +
> > file.getAbsolutePath(), e);
> > +               }
> > +
> > +               return duration;
> > +       }
> > +
> >  }
> > Index:
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPHandler.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPHandler.java
> > (revision 1124)
> > +++
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPHandler.java
> > (revision 1132)
> > @@ -271,4 +271,5 @@
> >
> >                 boolean disconnectOnReturn = false;
> > +               boolean runBandwidthCheck = false;
> >                 if(call.getServiceName() == null){
> >                         log.info ("call: "+call);
> > @@ -312,5 +313,7 @@
> >
> ((IPendingServiceCall)
> > call).setResult(getStatus(NC_CONNECT_SUCCESS));
> >
> //
> > Measure initial roundtrip time after connecting
> > +
> > conn.getChannel((byte) 2).write(new Ping((short)0,0,-1));
> >
> conn.ping();
> > +
> > runBandwidthCheck = true;
> >                                                                 }
> > else {
> >
> > log.debug("connect failed");
> > @@ -372,4 +375,7 @@
> >                         log.debug("sending reply");
> >                         channel.write(reply);
> > +                       if (runBandwidthCheck){
> > +                               conn.runBandwidthCheck();
> > +                       }
> >                         if (disconnectOnReturn)
> >                                 conn.close();
> > @@ -388,4 +394,7 @@
> >                 }
> >
> > +               log.warn("Unhandled ping: "+ping);
> > +
> > +               /*
> >                 final Ping pong = new Ping();
> >                 pong.setValue1((short) 4);
> > @@ -399,4 +408,5 @@
> >                  pong2.setValue2(source.getStreamId());
> >                 channel.write(pong2);
> > +               */
> >         }
> >
> > Index:
> > /java/server/trunk/src/org/red5/server/net/rtmp/event/Ping.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/net/rtmp/event/Ping.java
> > (revision 1124)
> > +++
> > /java/server/trunk/src/org/red5/server/net/rtmp/event/Ping.java
> > (revision 1132)
> > @@ -22,4 +22,14 @@
> >  public class Ping extends BaseEvent {
> >
> > +       public static final short STREAM_CLEAR = 0;
> > +       public static final short STREAM_PLAY = 1;
> > +       public static final short UNKNOWN_2 = 2;
> > +       public static final short CLIENT_BUFFER = 3;
> > +       public static final short STREAM_RESET = 4;
> > +       public static final short UNKNOWN_5 = 5;
> > +       public static final short PING_CLIENT = 6;
> > +       public static final short PONG_SERVER = 7;
> > +       public static final short UNKNOWN_8 = 8;
> > +
> >         public static final int UNDEFINED = -1;
> >
> > @@ -27,4 +37,5 @@
> >         private int value2 = 0;
> >         private int value3 = UNDEFINED;
> > +       private int value4 = UNDEFINED;
> >         private String debug = "";
> >
> > @@ -44,4 +55,12 @@
> >                 this.value2 = value2;
> >                 this.value3 = value3;
> > +       }
> > +
> > +       public Ping(short value1, int value2, int value3, int value4){
> > +               super( Type.SYSTEM);
> > +               this.value1 = value1;
> > +               this.value2 = value2;
> > +               this.value3 = value3;
> > +               this.value4 = value4;
> >         }
> >
> > @@ -74,6 +93,12 @@
> >         }
> >
> > -
> > -
> > +       public int getValue4() {
> > +               return value4;
> > +       }
> > +
> > +       public void setValue4(int value4) {
> > +               this.value4 = value4;
> > +       }
> > +
> >         public String getDebug() {
> >                 return debug;
> > @@ -88,8 +113,9 @@
> >                 value2 = 0;
> >                 value3 = UNDEFINED;
> > +               value4 = UNDEFINED;
> >         }
> >
> >         public String toString(){
> >  -               return "Ping: "+value1+", "+value2+", "+value3+" \n" +
> > debug;
> > +               return "Ping: "+value1+", "+value2+", "+value3+",
> > "+value4+"\n" + debug;
> >         }
> >
> > Index:
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
> > (revision 1124)
> > +++
> > /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
> > (revision 1132)
> > @@ -31,4 +31,5 @@
> >  import org.red5.server.BaseConnection;
> >  import org.red5.server.api.IBandwidthConfigure;
> > +import org.red5.server.api.IConnection ;
> >  import org.red5.server.api.IContext;
> >  import org.red5.server.api.IFlowControllable;
> > @@ -56,24 +57,33 @@
> >  import org.springframework.context.ApplicationContext;
> >
> > -public abstract class RTMPConnection extends BaseConnection
> > -       implements IStreamCapableConnection, IServiceCapableConnection {
> > -
> > -       protected static Log log =
> > -        LogFactory.getLog(RTMPConnection.class.getName());
> > +public abstract class RTMPConnection extends BaseConnection implements
> > +               IStreamCapableConnection, IServiceCapableConnection {
> > +
> > +       protected static Log log = LogFactory
> > +                       .getLog(RTMPConnection.class.getName());
> >
> >         private final static int MAX_STREAMS = 12;
> > +
> >         private final static String VIDEO_CODEC_FACTORY =
> > "videoCodecFactory";
> > -
> > -       //private Context context;
> > +
> > +       // private Context context;
> >         private Channel[] channels = new Channel[64];
> > +
> >         private IClientStream[] streams = new
> IClientStream[MAX_STREAMS];
> > +
> >         private boolean[] reservedStreams = new boolean[MAX_STREAMS];
> > +
> >         protected Integer invokeId = new Integer(1);
> > -       protected HashMap<Integer,IPendingServiceCall>
> > pendingCalls = new HashMap<Integer,IPendingServiceCall>();
> > +
> > +       protected HashMap<Integer, IPendingServiceCall> pendingCalls =
> new
> > HashMap<Integer, IPendingServiceCall>();
> > +
> >         protected int lastPingTime = -1;
> > +
> >         protected int streamBytesRead = 0;
> > +
> >         private int streamBytesReadInterval = 125000;
> > +
> >         private int nextStreamBytesRead = 125000;
> >  -
> > +
> >         private IBandwidthConfigure bandwidthConfig;
> >
> > @@ -81,9 +91,10 @@
> >                 // We start with an anonymous connection without a
> scope.
> >                 // These parameters will be set during the call of
> "connect"
> > later.
> > -               //super(null, "");      temp fix to get things to
> compile
> > -               super(type,null,null,null,null,null);
> > -       }
> > -
> > -       public void setup(String host, String path, String sessionId,
> > Map<String, String> params){
> > +               // super(null, ""); temp fix to get things to compile
> > +               super(type, null, null, null, null, null);
> > +       }
> > +
> > +       public void setup(String host, String path, String sessionId,
> > +                       Map<String, String> params) {
> >                 this.host = host;
> >                 this.path = path;
> > @@ -91,9 +102,9 @@
> >                 this.params = params;
> >         }
> > -
> >  -       public int getNextAvailableChannelId(){
> > +
> > +       public int getNextAvailableChannelId() {
> >                 int result = -1;
> > -               for(byte i=4; i<channels.length; i++){
> > -                       if(!isChannelUsed(i)){
> > +               for (byte i = 4; i < channels.length; i++) {
> > +                       if (!isChannelUsed(i)) {
> >                                 result = i;
> >                                 break;
> > @@ -102,23 +113,23 @@
> >                 return result;
> >         }
> > -
> > -       public boolean isChannelUsed(byte channelId){
> > +
> > +       public boolean isChannelUsed(byte channelId) {
> >                 return (channels[channelId] != null);
> >         }
> >
> > -       public Channel getChannel(byte channelId){
> > -               if(!isChannelUsed(channelId))
> > +       public Channel getChannel(byte channelId) {
> > +               if (!isChannelUsed(channelId))
> >                         channels[channelId] = new
> > Channel(this, channelId);
> >                 return channels[channelId];
> >         }
> > -
> > -       public void closeChannel(byte channelId){
> > +
> > +       public void closeChannel(byte channelId) {
> >                 channels[channelId] = null;
> >         }
> > -
> > +
> >         public int reserveStreamId() {
> >                 int result = -1;
> >                 synchronized (reservedStreams) {
> > -                       for (int i=0; i< reservedStreams.length; i++) {
> > +                       for (int i = 0; i < reservedStreams.length; i++)
> {
> >                                 if (!reservedStreams[i]) {
> >                                         reservedStreams[i]
> > = true;
> > @@ -130,5 +141,5 @@
> >                 return result + 1;
> >         }
> > -
> > +
> >         public OutputStream createOutputStream(int streamId) {
> >                 byte channelId = (byte) (4 + ((streamId - 1) * 5));
> > @@ -136,9 +147,9 @@
> >                 final Channel video = getChannel(channelId++);
> >                 final Channel audio = getChannel(channelId++);
> > -               //final Channel unknown = getChannel(channelId++);
> > -               //final Channel ctrl = getChannel(channelId++);
> > +               // final Channel unknown = getChannel(channelId++);
> > +               // final Channel ctrl = getChannel(channelId++);
> >                 return new OutputStream(video, audio, data);
> >         }
> > -
> > +
> >         public VideoCodecFactory getVideoCodecFactory() {
> >                 final IContext context = scope.getContext();
> > @@ -146,17 +157,17 @@
> >                 if
> > (!appCtx.containsBean(VIDEO_CODEC_FACTORY))
> >                         return null;
> > -
> > +
> >                 return (VideoCodecFactory)
> > appCtx.getBean(VIDEO_CODEC_FACTORY);
> >         }
> > -
> > +
> >         public IClientBroadcastStream newBroadcastStream(int streamId) {
> >                 if (!reservedStreams[streamId - 1])
> >                         // StreamId has not been reserved before
> >                         return null;
> > -
> > +
> >                 if (streams[streamId - 1] != null)
> >                         // Another stream already exists with this id
> >                         return null;
> > -
> > +
> >                 ClientBroadcastStream cbs = new
> > ClientBroadcastStream();
> >                 cbs.setStreamId (streamId);
> > @@ -168,19 +179,20 @@
> >                 return cbs;
> >         }
> > -
> > -       public ISingleItemSubscriberStream
> > newSingleItemSubscriberStream(int streamId) {
> > +
> > +       public ISingleItemSubscriberStream
> newSingleItemSubscriberStream(
> > +                       int streamId) {
> >                 // TODO implement it
> >                 return null;
> >         }
> > -
> > +
> >         public IPlaylistSubscriberStream newPlaylistSubscriberStream(int
> > streamId) {
> >                 if (!reservedStreams[streamId - 1])
> >                         // StreamId has not been reserved before
> >                         return null;
> > -
> > +
> >                 if (streams[streamId - 1] != null)
> >                         // Another stream already exists with this id
> >                         return null;
> > -
> > +
> >                 PlaylistSubscriberStream pss = new
> > PlaylistSubscriberStream();
> >                  pss.setName(createStreamName());
> > @@ -191,30 +203,31 @@
> >                 return pss;
> >         }
> > -
> > -       public IClientStream getStreamById(int id){
> > -               if (id <= 0 || id > MAX_STREAMS-1)
> > -                       return null;
> > -
> > -               return streams[id-1];
> > -       }
> > -
> > -       public IClientStream getStreamByChannelId(byte channelId){
> > +
> > +       public IClientStream getStreamById(int id) {
> > +               if (id <= 0 || id > MAX_STREAMS - 1)
> > +                       return null;
> > +
> > +               return streams[id - 1];
> > +       }
> > +
> > +       public IClientStream getStreamByChannelId(byte channelId) {
> >                 if (channelId < 4)
> >                         return null;
> > -
> > -               //log.debug("Channel id: "+channelId);
> > -               int id = (int) Math.floor((channelId-4)/5);
> >  -               //log.debug("Stream: "+streamId);
> > +
> > +               // log.debug("Channel id: "+channelId);
> > +               int id = (int) Math.floor((channelId - 4) / 5);
> > +               // log.debug("Stream: "+streamId);
> >                 return streams[id];
> >         }
> > -
> > -       public void close(){
> > -               IStreamService streamService = (IStreamService)
> > getScopeService(scope, IStreamService.STREAM_SERVICE,
> StreamService.class);
> > +
> > +       public void close() {
> > +               IStreamService streamService = (IStreamService)
> > getScopeService(scope,
> > +                               IStreamService.STREAM_SERVICE ,
> > StreamService.class);
> >                 if (streamService != null) {
> >                         synchronized (streams) {
> > -                               for(int i=0; i<streams.length; i++){
> > +                               for (int i = 0; i < streams.length; i++)
> {
> >                                         IClientStream
> > stream = streams[i];
> > -                                       if(stream != null)
> > {
> > -                                               log.debug
> > ("Closing stream: "+ stream.getStreamId());
> > +                                       if (stream != null)
> > {
> > +
> > log.debug("Closing stream: " + stream.getStreamId ());
> >
> streamService.deleteStream(this,
> > stream.getStreamId());
> >                                                 streams[i]
> > = null;
> > @@ -223,27 +236,28 @@
> >                         }
> >                 }
> > -               IFlowControlService fcs = (IFlowControlService)
> > getScope().getContext().getBean(
> > -                               IFlowControlService.KEY);
> > +               IFlowControlService fcs = (IFlowControlService)
> > getScope().getContext()
> > +                               .getBean(IFlowControlService.KEY);
> >                 fcs.releaseFlowControllable(this);
> >                 super.close();
> >         }
> > -
> > +
> >         public void unreserveStreamId(int streamId) {
> >                 if (streamId > 0 && streamId <= MAX_STREAMS) {
> > -                       streams[streamId-1] = null;
> > -                       reservedStreams[streamId-1] = false;
> > -               }
> >  -       }
> > -
> > -       public void ping(Ping ping){
> > -               getChannel((byte)2).write(ping);
> > -       }
> > -
> > +                       streams[streamId - 1] = null;
> > +                       reservedStreams[streamId - 1] = false;
> > +               }
> > +       }
> > +
> > +       public void ping(Ping ping) {
> > +               getChannel((byte) 2).write(ping);
> > +       }
> > +
> >         public abstract void rawWrite(ByteBuffer out);
> > +
> >         public abstract void write(Packet out);
> >
> >         public void updateStreamBytesRead(int bytes) {
> >                 streamBytesRead += bytes;
> > -
> > +
> >                 if (streamBytesRead >= nextStreamBytesRead) {
> >                         BytesRead sbr = new
> > BytesRead(streamBytesRead);
> > @@ -253,5 +267,5 @@
> >                 }
> >         }
> > -
> > +
> >         public void invoke(IServiceCall call) {
> >                 // We need to use Invoke for all calls to the client
> > @@ -273,21 +287,22 @@
> >                 invoke(method, null, null);
> >         }
> > -
> > +
> >         public void invoke(String method, Object[] params) {
> >                 invoke(method, params, null);
> >         }
> > -
> > +
> >         public void invoke(String method, IPendingServiceCallback
> callback)
> > {
> >                 invoke(method, null, callback);
> >         }
> > -
> > -       public void invoke(String method, Object[] params,
> > IPendingServiceCallback callback) {
> > +
> > +       public void invoke(String method, Object[] params,
> > +                       IPendingServiceCallback callback) {
> >                 IPendingServiceCall call = new
> > PendingCall(method, params);
> >                 if (callback != null)
> >                         call.registerCallback (callback);
> > -
> > +
> >                 invoke(call);
> >         }
> > -
> > +
> >         public IBandwidthConfigure getBandwidthConfigure() {
> >                 return bandwidthConfig;
> > @@ -299,6 +314,6 @@
> >
> >         public void
> > setBandwidthConfigure(IBandwidthConfigure config) {
> > -               IFlowControlService fcs = (IFlowControlService)
> > getScope().getContext().getBean(
> > -                               IFlowControlService.KEY);
> > +               IFlowControlService fcs = (IFlowControlService)
> > getScope().getContext()
> > +                               .getBean(IFlowControlService.KEY);
> >                 this.bandwidthConfig = config;
> >                 fcs.updateBWConfigure(this);
> > @@ -326,21 +341,21 @@
> >                 return result;
> >         }
> > -
> > +
> >         protected String createStreamName() {
> >                 return UUID.randomUUID().toString();
> >         }
> > -
> > +
> >         protected void messageReceived() {
> >                 readMessages++;
> >         }
> > -
> > +
> >         protected void messageSent() {
> >                 writtenMessages++;
> >         }
> > -
> > +
> >         protected void messageDropped() {
> >                 droppedMessages++;
> >         }
> > -
> > +
> >         public void ping() {
> >                 Ping pingRequest = new Ping();
> > @@ -351,13 +366,37 @@
> >                 ping(pingRequest);
> >         }
> > -
> > +
> >         protected void pingReceived(Ping pong) {
> >                 int now = (int) (System.currentTimeMillis() &
> 0xffffffff);
> >                 lastPingTime = now - pong.getValue2();
> >         }
> > -
> > +
> >         public int getLastPingTime() {
> >                 return lastPingTime;
> >         }
> > -
> > +
> > +       public void runBandwidthCheck() {
> > +               // dummy for now, this makes flv player work
> > +               // they dont wait for connected status they wait for
> > onBWDone
> > +               invoke("onBWDone",new Object[]{});
> > +               /*
> > +               invoke("onBWCheck", new Object[] {}, new
> > IPendingServiceCallback() {
> > +                       public void
> > resultReceived(IPendingServiceCall call) {
> > +                               log.debug("onBWCheck 1 result: " +
> > call.getResult());
> > +                       }
> > +               });
> > +               int[] filler = new int[1024];
> > +               invoke("onBWCheck", new Object[] { filler }, new
> > IPendingServiceCallback() {
> > +                       public void
> > resultReceived(IPendingServiceCall call) {
> > +                               log.debug("onBWCheck 2 result: " +
> > call.getResult());
> > +                               invoke("onBWDone", new Object[] { new
> > Integer(1000), new Integer(300), new Integer(6000), new Integer(300) },
> new
> > IPendingServiceCallback() {
> > +                                       public void
> > resultReceived(IPendingServiceCall call) {
> > +
> > log.debug("onBWDone result: " + call.getResult());
> > +                                       }
> > +                               });
> > +                       }
> > +               });*/
> > +
> > +       }
> > +
> >  }
> > Index:
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/Status.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/Status.java
> > (revision 1082)
> > +++
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/Status.java
> > (revision 1132)
> > @@ -1,3 +1,5 @@
> >  package org.red5.server.net.rtmp.status ;
> > +
> > +import org.red5.io.object.SerializerOpts;
> >
> >  /*
> > @@ -20,5 +22,5 @@
> >   */
> >
> > -public class Status implements StatusCodes {
> > +public class Status implements StatusCodes, SerializerOpts {
> >
> >         public static final String ERROR = "error";
> > @@ -99,8 +101,14 @@
> >         }
> >
> > +
> > +       public String toString(){
> > +               return "Status: code: "+getCode()
> > +                       + " desc: "+getDescription()
> > +                       + " level: "+getLevel();
> > +       }
> >
> > -
> > -       public String toString(){
> > -               return "Status: "+code;
> > +       public Flag getSerializerOption(SerializerOption
> > opt) {
> > +               if(opt ==
> > SerializerOption.SerializeClassName ) return Flag.Disabled;
> > +               return Flag.Default;
> >         }
> >
> > Index:
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObject.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObject.java
> > (revision 1082)
> > +++
> > /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObject.java
> > (revision 1132)
> > @@ -22,4 +22,6 @@
> >  import java.io.Serializable;
> >
> > +import org.red5.io.object.SerializerOpts;
> > +
> >  /**
> >   *
> > @@ -27,5 +29,5 @@
> >   * @author Luke Hubbard, Codegent Ltd (luke at codegent.com)
> >   */
> > -public class StatusObject implements Serializable {
> > +public class StatusObject implements Serializable, SerializerOpts {
> >
> >         private static final long serialVersionUID =
> 8817297676191096283L;
> > @@ -82,3 +84,14 @@
> >         }
> >
> > +       public String toString(){
> > +               return "Status code: "+getCode()
> > +                       + " desc: "+getDescription()
> > +                       + " level: "+getLevel();
> > +       }
> > +
> > +       public Flag getSerializerOption(SerializerOption
> > opt) {
> > +               if(opt ==
> > SerializerOption.SerializeClassName) return Flag.Disabled;
> > +               return Flag.Default;
> > +       }
> > +
> >  }
> > Index:
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObjectService.java
> > ===================================================================
> > ---
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObjectService.java
> > (revision 1082)
> > +++
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/status/StatusObjectService.java
> > (revision 1132)
> > @@ -70,5 +70,5 @@
> >                 statusObjects.put(NC_CONNECT_FAILED,new
> > StatusObject(NC_CONNECT_FAILED,StatusObject.ERROR ,""));
> >                 statusObjects.put(NC_CONNECT_REJECTED,new
> > StatusObject(NC_CONNECT_REJECTED,StatusObject.ERROR,""));
> > -               statusObjects.put(NC_CONNECT_SUCCESS,new
> > StatusObject(NC_CONNECT_SUCCESS, StatusObject.STATUS,""));
> > +               statusObjects.put(NC_CONNECT_SUCCESS,new
> > StatusObject(NC_CONNECT_SUCCESS,StatusObject.STATUS,"Connection
> > succeeded."));
> >
> >                 statusObjects.put (NS_CLEAR_SUCCESS,new
> > StatusObject(NS_CLEAR_SUCCESS,StatusObject.STATUS,""));
> > Index:
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java
> > ===================================================================
> > ---
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java
> > (revision 1125)
> > +++
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java
> > (revision 1132)
> > @@ -369,5 +369,7 @@
> >          */
> >         public ByteBuffer encodePing(Ping ping){
> > -               final int len =  (ping.getValue3()==Ping.UNDEFINED) ? 6
> : 8;
> > +               int len = 6;
> > +               if(ping.getValue3()!=Ping.UNDEFINED ) len +=4;
> > +               if(ping.getValue4()!=Ping.UNDEFINED) len +=4;
> >                 final ByteBuffer out = ByteBuffer.allocate(len);
> >                 out.putShort(ping.getValue1());
> > @@ -375,4 +377,6 @@
> >                  if(ping.getValue3()!=Ping.UNDEFINED)
> >                         out.putInt(ping.getValue3());
> > +               if(ping.getValue4()!=Ping.UNDEFINED)
> > +                       out.putInt(ping.getValue4());
> >                 return out;
> >         }
> > Index:
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
> > ===================================================================
> > ---
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
> > (revision 1124)
> > +++
> >
> /java/server/trunk/src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
> > (revision 1132)
> > @@ -514,7 +514,9 @@
> >         public Ping decodePing(ByteBuffer in) {
> >                 final Ping ping = new Ping();
> > +               ping.setDebug(in.getHexDump());
> >                 ping.setValue1(in.getShort());
> >                 ping.setValue2(in.getInt());
> >                 if(in.hasRemaining()) ping.setValue3(in.getInt());
> >  +               if(in.hasRemaining()) ping.setValue4(in.getInt());
> >                 return ping;
> >         }
> > Index:
> >
> /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java
> > ===================================================================
> > ---
> >
> /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java
> > (revision 1127)
> > +++
> >
> /java/server/trunk/src/org/red5/server/stream/PlaylistSubscriberStream.java
> > (revision 1132)
> > @@ -586,4 +586,5 @@
> >                         if (isPullMode) {
> >                                 state = State.PAUSED;
> > +                               sendClearPing();
> >                                 sendPauseStatus(currentItem);
> >                                 notifyItemPause(currentItem,
> > position);
> > @@ -612,7 +613,8 @@
> >                                 flowControlService.resetTokenBuckets(
> PlaylistSubscriberStream.this);
> >                                 isWaitingForToken = false;
> > +                               sendClearPing();
> > +                               sendResetPing();
> >                                 sendSeekStatus(currentItem,
> > position);
> >                                 sendStartStatus(currentItem);
> > -                               sendResetPing();
> >                                 sendBlankAudio(position);
> >                                 sendBlankVideo(position);
> > @@ -642,4 +644,5 @@
> >                         isWaitingForToken = false;
> >                         notifyItemStop(currentItem);
> > +                       sendClearPing();
> >                 }
> >
> > @@ -668,4 +671,5 @@
> >                                 liveLengthJob = null;
> >                         }
> > +                       sendClearPing();
> >                 }
> >
> > @@ -755,4 +759,14 @@
> >                 }
> >
> > +               private void sendClearPing() {
> > +                       Ping ping1 = new Ping();
> >  +                       ping1.setValue1((short) 1);
> > +                       ping1.setValue2(getStreamId());
> > +
> > +                       RTMPMessage ping1Msg = new RTMPMessage();
> > +                       ping1Msg.setBody (ping1);
> > +                       msgOut.pushMessage(ping1Msg);
> > +               }
> > +
> >                 private void sendResetPing() {
> >                         Ping ping1 = new Ping();
> > Index:
> > /java/server/trunk/src/org/red5/server/stream/ProviderService.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/stream/ProviderService.java
> > (revision 1084)
> > +++
> > /java/server/trunk/src/org/red5/server/stream/ProviderService.java
> > (revision 1132)
> > @@ -60,4 +60,12 @@
> >
> >         public IMessageInput getVODProviderInput(IScope scope, String
> name)
> > {
> > +               File file = getVODProviderFile(scope, name);
> > +               if(file == null) return null;
> >  +               IPipe pipe = new InMemoryPullPullPipe();
> > +               pipe.subscribe(new FileProvider(scope, file), null);
> > +               return pipe;
> > +       }
> > +
> > +       public File getVODProviderFile(IScope scope, String name){
> >                 File file = null;
> >                 try {
> > @@ -67,9 +75,7 @@
> >                         return null;
> >                 }
> > -               IPipe pipe = new InMemoryPullPullPipe();
> > -               pipe.subscribe(new FileProvider(scope, file), null);
> > -               return pipe;
> > +               return file;
> >         }
> > -
> > +
> >         public boolean registerBroadcastStream(IScope scope, String
> name,
> > IBroadcastStream bs) {
> >                 synchronized (scope) {
> > Index:
> > /java/server/trunk/src/org/red5/server/stream/IProviderService.java
> > ===================================================================
> > ---
> > /java/server/trunk/src/org/red5/server/stream/IProviderService.java
> > (revision 1092)
> > +++
> > /java/server/trunk/src/org/red5/server/stream/IProviderService.java
> > (revision 1132)
> > @@ -20,4 +20,5 @@
> >   */
> >
> > +import java.io.File;
> >  import java.util.List;
> >
> > @@ -55,4 +56,12 @@
> >
> >         /**
> > +        * Get a named VOD source file.
> > +        * @param scope
> > +        * @param name
> > +        * @return <tt>null</tt> if not found.
> > +        */
> > +       File getVODProviderFile(IScope scope, String name);
> > +
> > +       /**
> >          * Register a broadcast stream to a scope.
> >          * @param scope
> > Index:
> > /java/io/trunk/src/org/red5/io/flv/impl/FLVReader.java
> > ==============
> >
> > Note:
> > Diffs are chopped if more than 25k.
> > This is to get past the limit on the mailing list.
> >
> > _______________________________________________
> > Red5commits mailing list
> > Red5commits at osflash.org
> > http://osflash.org/mailman/listinfo/red5commits_osflash.org
> >
> >
> > --
> > John Grden
> > _______________________________________________
> > Red5devs mailing list
> > Red5devs at osflash.org
> > http://osflash.org/mailman/listinfo/red5devs_osflash.org
> >
> >
> >
>



-- 
John Grden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5devs_osflash.org/attachments/20060710/03cc1117/attachment-0001.htm


More information about the Red5devs mailing list