Closed malamalca closed 1 year ago
While waiting for the fix, consider migrating to https://gitee.com/yowfung/flutter_mjpeg_view
It's in Chinese and a bit messy, but it properly reads the stream
That should be fixed thanks to https://github.com/mylisabox/flutter_mjpeg/pull/24 Try 2.0.2 and let me know
@jaumard I am using 2.0.3 and experience this behaviour again
Flutter Channel stable, 3.3.9, on macOS 12.6.1 21G217 darwin-arm,
════════ Exception caught by image resource service ════════════════════════════
The following _Exception was thrown resolving an image codec:
Exception: Invalid image data
When the exception was thrown, this was the stack
#0 _futurize (dart:ui/painting.dart:5886:5)
#1 ImageDescriptor.encoded (dart:ui/painting.dart:5741:12)
#2 instantiateImageCodecFromBuffer (dart:ui/painting.dart:2092:60)
#3 PaintingBinding.instantiateImageCodecFromBuffer
package:flutter/…/painting/binding.dart:153
#4 MemoryImage._loadAsync
package:flutter/…/painting/image_provider.dart:1090
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════
Hi @guycalledseven, sorry I've only seen this just now.
While my PR that caused @jaumard to close this issue did improve the situation, I don't think flutter_mjpeg
can make any definitive guarantees to prevent this exception. I have opened an issue with Flutter itself regarding this a while ago.
This library can ensure that it captures the SOI and EOI markers of a JPEG correctly and that it sends the contents as a proper frame to Flutter for rendering. It cannot however make sure that the bytes between the SOI and EOI markers are acutally a valid JPEG. It would be up to Flutter to properly use the errorBuilder
in this case (as is intended and written in their documentation).
very cool, thanks for update @cybrox
This bug is continuation of #14
Stream playback via http is much better with latest update - there are no more visible glitches. Despite that I am still getting errors about corrupted images (see below).
The second problem is similar to #14. The stream is still glitchy when playing it via encrypted connection (https).
I think that the problem with race conditions in async routines is still not fully solved. Animation frames (jpeg images) are still overlapping when streaming via ssl.