Skip to content

Instantly share code, notes, and snippets.

@BogdanovKirill
Created September 16, 2019 13:27
Show Gist options
  • Save BogdanovKirill/8fb7d7b4f6fd858ffe67d6f0b03c0082 to your computer and use it in GitHub Desktop.
Save BogdanovKirill/8fb7d7b4f6fd858ffe67d6f0b03c0082 to your computer and use it in GitHub Desktop.
Test fix for JPEG parser
private void GenerateFrame(TimeSpan timeOffset)
{
if (!ArrayUtils.EndsWith(_frameStream.GetBuffer(),0,
(int)_frameStream.Position, RawJpegFrame.EndMarkerBytes))
_frameStream.Write(JpegEndMarkerByteSegment.Array, JpegEndMarkerByteSegment.Offset, JpegEndMarkerByteSegment.Count);
DateTime timestamp = GetFrameTimestamp(timeOffset);
var frameBytes = new ArraySegment<byte>(_frameStream.GetBuffer(), 0, (int)_frameStream.Position);
_frameStream.Position = 0;
var frame = new RawJpegFrame(timestamp, frameBytes);
OnFrameGenerated(frame);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment