Exemplo n.º 1
0
        void FeedVideoCodecSetup(IOutStream pOutStream)
        {
            if (!pOutStream.FeedData(
                    Utils.Rms.GetStream("sps", Capabilities.Avc.SPS, 0, Capabilities.Avc.SPS.Length),

                    Capabilities.Avc.SpsLength,
                    0,
                    Capabilities.Avc.SpsLength,
                    _videoLastTs,
                    false))
            {
                FATAL("Unable to feed stream");
                if (pOutStream.GetProtocol() != null)
                {
                    pOutStream.GetProtocol().EnqueueForDelete();
                }
            }
            if (!pOutStream.FeedData(
                    Utils.Rms.GetStream("pps", Capabilities.Avc.PPS, 0, Capabilities.Avc.PPS.Length),
                    Capabilities.Avc.PpsLength,
                    0,
                    Capabilities.Avc.PpsLength,
                    _videoLastTs,
                    false))
            {
                FATAL("Unable to feed stream");
                if (pOutStream.GetProtocol() != null)
                {
                    pOutStream.GetProtocol().EnqueueForDelete();
                }
            }
        }
Exemplo n.º 2
0
 protected override void AudioHandler(Stream packet)
 {
     if (_publisher != null && _publisher.PublisherId == StreamId)
     {
         var time   = packet.ReadUInt();
         var length = (uint)packet.GetAvaliableByteCounts();
         // _publication.PushAudioPacket(packet.ReadUInt32(), packet, _numberLostFragments);
         _publisher.FeedData(packet, length, 0, length, time, true);
         _numberLostFragments = 0;
     }
     else if (OutStream != null)
     {
         var time   = packet.ReadUInt();
         var length = (uint)packet.GetAvaliableByteCounts();
         TotalBytes += length;
         OutStream.FeedData(packet, length, 0, length, time, true);
     }
 }
Exemplo n.º 3
0
        public override void SignalOutStreamAttached(IOutStream pOutStream)
        {
            if (_videoCodecInit.Length > 0 &&
                !pOutStream.FeedData(_videoCodecInit, (uint)_videoCodecInit.Length, 0, (uint)_videoCodecInit.Length, _lastVideoTime, false))
            {
                this.Log().Info("Unable to feed OS: {0}", pOutStream.UniqueId);
                pOutStream.EnqueueForDelete();
            }
            if (_audioCodecInit.Length > 0 &&
                !pOutStream.FeedData(_audioCodecInit, (uint)_audioCodecInit.Length, 0, (uint)_audioCodecInit.Length, _lastAudioTime, true))
            {
                this.Log().Info("Unable to feed OS: {0}", pOutStream.UniqueId);
                pOutStream.EnqueueForDelete();
            }

            //if (_lastStreamMessage != null &&pOutStream.Type.TagKindOf(StreamTypes.ST_OUT_NET_RTMP))
            //{
            //    (pOutStream as IOutNetStream).SendStreamMessage(_lastStreamMessage.Value.Body, _lastStreamMessage.Value.MessageLength);
            //}
            base.SignalOutStreamAttached(pOutStream);
        }
Exemplo n.º 4
0
        //public override bool IsCompatibleWithType(ulong type)
        //{
        //    return type.TagKindOf(StreamTypes.ST_OUT_NET_RTMP_4_RTMP)
        //        || type.TagKindOf(StreamTypes.ST_OUT_NET_RTMFP)
        //           || type.TagKindOf(StreamTypes.ST_OUT_FILE_RTMP)
        //           || type.TagKindOf(StreamTypes.ST_OUT_NET_RTP)
        //           || type.TagKindOf(StreamTypes.ST_OUT_FILE_HLS);
        //}

        public override void SignalOutStreamAttached(IOutStream pOutStream)
        {
            if (VideoCodecBuffer.Length > 0 &&
                !pOutStream.FeedData(VideoCodecBuffer, (uint)VideoCodecBuffer.Length, 0, (uint)VideoCodecBuffer.Length, _lastVideoTime, false))
            {
                this.Log().Info("Unable to feed OS: {0}", pOutStream.UniqueId);
                pOutStream.EnqueueForDelete();
            }
            if (AudioCodecBuffer.Length > 0 &&
                !pOutStream.FeedData(AudioCodecBuffer, (uint)AudioCodecBuffer.Length, 0, (uint)AudioCodecBuffer.Length, _lastAudioTime, false))
            {
                this.Log().Info("Unable to feed OS: {0}", pOutStream.UniqueId);
                pOutStream.EnqueueForDelete();
            }
            //if (_lastStreamMessage != null
            //    && pOutStream.Type.TagKindOf(StreamTypes.ST_OUT_NET_RTMP)
            //    && !(pOutStream as BaseOutNetRTMPStream).SendStreamMessage(_lastStreamMessage))
            //{
            //    Logger.FATAL("Unable to send notify on stream. The connection will go down");
            //    pOutStream.EnqueueForDelete();
            //}

            base.SignalOutStreamAttached(pOutStream);
        }
Exemplo n.º 5
0
 void FeedAudioCodecSetup(IOutStream pOutStream)
 {
     if (Capabilities.AudioCodecId == AudioCodec.Aac)
     {
         if (!pOutStream.FeedData(
                 Utils.Rms.GetStream("aac", Capabilities.Aac._pAAC, 0, Capabilities.Aac._pAAC.Length),
                 Capabilities.Aac._aacLength,
                 0,
                 Capabilities.Aac._aacLength,
                 _audioLastTs,
                 true))
         {
             FATAL("Unable to feed stream");
             if (pOutStream.GetProtocol() != null)
             {
                 pOutStream.GetProtocol().EnqueueForDelete();
             }
         }
     }
 }