예제 #1
0
/*
 * FlexInvoke flexInvoke = new FlexInvoke();
 * flexInvoke.Cmd = "onstatus";
 * flexInvoke.DataType = DataType.TypeUnknown;
 * StatusASO statusASO = StatusASO.GetStatusObject(StatusASO.NC_CONNECT_CLOSED, connection.ObjectEncoding);
 * flexInvoke.Parameters = new object[]{ statusASO };
 * RtmpChannel channel = connection.GetChannel(3);
 * channel.Write(flexInvoke);
 */


        protected override void OnChunkSize(RtmpConnection connection, RtmpChannel channel, RtmpHeader source, ChunkSize chunkSize)
        {
            if (connection is IStreamCapableConnection)
            {
                IStreamCapableConnection streamCapableConnection = connection as IStreamCapableConnection;
                {
                    foreach (IClientStream stream in streamCapableConnection.GetStreams())
                    {
                        if (stream is IClientBroadcastStream)
                        {
                            IClientBroadcastStream bs    = stream as IClientBroadcastStream;
                            IBroadcastScope        scope = bs.Scope.GetBasicScope(Constants.BroadcastScopeType, bs.PublishedName) as IBroadcastScope;
                            if (scope == null)
                            {
                                continue;
                            }

                            OOBControlMessage setChunkSize = new OOBControlMessage();
                            setChunkSize.Target      = "ClientBroadcastStream";
                            setChunkSize.ServiceName = "chunkSize";
                            setChunkSize.ServiceParameterMap.Add("chunkSize", chunkSize.Size);
                            scope.SendOOBControlMessage((IConsumer)null, setChunkSize);
                            if (log.IsDebugEnabled)
                            {
                                log.Debug("Sending chunksize " + chunkSize + " to " + bs.Provider);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
 protected override void OnChunkSize(RtmpConnection connection, RtmpChannel channel, RtmpHeader source, ChunkSize chunkSize)
 {
     if (connection is IStreamCapableConnection)
     {
         IStreamCapableConnection connection2 = connection as IStreamCapableConnection;
         foreach (IClientStream stream in connection2.GetStreams())
         {
             if (stream is IClientBroadcastStream)
             {
                 IClientBroadcastStream stream2    = stream as IClientBroadcastStream;
                 IBroadcastScope        basicScope = stream2.Scope.GetBasicScope("bs", stream2.PublishedName) as IBroadcastScope;
                 if (basicScope != null)
                 {
                     OOBControlMessage oobCtrlMsg = new OOBControlMessage {
                         Target      = "ClientBroadcastStream",
                         ServiceName = "chunkSize"
                     };
                     oobCtrlMsg.ServiceParameterMap.Add("chunkSize", chunkSize.Size);
                     basicScope.SendOOBControlMessage(null, oobCtrlMsg);
                     if (log.get_IsDebugEnabled())
                     {
                         log.Debug(string.Concat(new object[] { "Sending chunksize ", chunkSize, " to ", stream2.Provider }));
                     }
                 }
             }
         }
     }
 }