Esempio n. 1
0
 private void HandleData(DataMessage message)
 {
     try
     {
         _metaData = message;
         _metaData.Data.RemoveAt(0);
     }
     catch
     {
         RtmpSession.Close();
     }
 }
Esempio n. 2
0
        private async void HandleAudioMessage(AudioMessage message)
        {
            try
            {
                _currentTimestamp = Math.Max(_currentTimestamp, message.MessageHeader.Timestamp);

                await SaveMessage(message);
            }
            catch
            {
                RtmpSession.Close();
            }
        }
Esempio n. 3
0
        private async void SendVideo(VideoMessage message)
        {
            var video = message.Clone() as VideoMessage;

            try
            {
                await MessageStream.SendMessageAsync(_videoChunkStream, video);
            }
            catch
            {
                foreach (var a in _cleanupActions)
                {
                    a();
                }
                RtmpSession.Close();
            }
        }
Esempio n. 4
0
        private async void SendAudio(AudioMessage message)
        {
            var audio = message.Clone();

            try
            {
                await MessageStream.SendMessageAsync(_audioChunkStream, audio as AudioMessage);
            }
            catch
            {
                foreach (var a in _cleanupActions)
                {
                    a();
                }
                RtmpSession.Close();
            }
        }
Esempio n. 5
0
        private async void HandleVideoMessage(VideoMessage message)
        {
            try
            {
                _currentTimestamp = Math.Max(_currentTimestamp, message.MessageHeader.Timestamp);

                var head = message.Data.Span[0];

                var data = FlvDemuxer.DemultiplexVideoData(message);
                if (data.FrameType == FrameType.KeyFrame)
                {
                    _keyframeTimes.Add((double)message.MessageHeader.Timestamp / 1000);
                    _keyframeFilePositions.Add((double)_recordFileData.Position);
                }

                await SaveMessage(message);
            }
            catch
            {
                RtmpSession.Close();
            }
        }