Exemplo n.º 1
0
        private void RegisterMuxedStreamEvent()
        {
            _muxedStreamCallback = (IntPtr stream, int streamSize, ulong offset, IntPtr userData) =>
            {
                using (var buffer = new ScopedMediaBuffer(stream, streamSize, true))
                {
                    MuxedStreamDelivered?.Invoke(this, new MuxedStreamDeliveredEventArgs(buffer, offset));
                }
            };

            Native.SetMuxedStreamCallback(_handle, _muxedStreamCallback, IntPtr.Zero).
            ThrowIfError("Failed to initialize MuxedStreamDelivered event");
        }
Exemplo n.º 2
0
        private void RegisterAudioStreamDeliveredEvent()
        {
            _audioStreamCallback = (stream, streamSize, type, channel, recordingTime, _) =>
            {
                var handler = AudioStreamStoring;
                if (handler != null)
                {
                    _isInAudioStreamStoring.Value = true;

                    using (var buffer = new ScopedMediaBuffer(stream, streamSize))
                    {
                        handler.Invoke(this,
                                       new AudioStreamStoringEventArgs(buffer, type, channel, recordingTime));
                    }
                }
            };

            Native.SetAudioStreamCallback(_handle, _audioStreamCallback, IntPtr.Zero).
            ThrowIfError("Failed to initialize AudioStreamStoring event");
        }