private void HandleData(DataMessage message) { try { _metaData = message; _metaData.Data.RemoveAt(0); } catch { RtmpSession.Close(); } }
private async void HandleAudioMessage(AudioMessage message) { try { _currentTimestamp = Math.Max(_currentTimestamp, message.MessageHeader.Timestamp); await SaveMessage(message); } catch { RtmpSession.Close(); } }
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(); } }
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(); } }
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(); } }