v0.2.0
API Addition
Introduction of the new Deivce.GetFrames that creates a pool of buffers to avoid continuous allocation. The method uses type Frame which not only returns the captured buffer from the driver, but also include metadata for each frame.
New pooling API for frame capture:
- device/frame.go - Frame struct with metadata (timestamp, sequence, flags)
- device/frame_pool.go - Buffer pool implementation using sync.Pool
- device/frame_pool_test.go - Pool performance benchmarks
- device/frame_test.go - Frame API unit tests
- examples/capture_frames/ - Complete example demonstrating new API
Fixes
Fix race condition in Device.Stop() and deprecate Device.GetOutput() API
The Device.Stop() method had a critical race condition causing segmentation faults during streaming cleanup.
Stop() would un-map memory buffers while capture goroutines were still accessing them, leading to crashes in
benchmarks and tests.
Updates
Test infrastructure improvements:
- test/integration_test.go - Removed all time.Sleep() workarounds, removed problematic
Integration tests and benchmarks
- test/main_test.go - Added binary checks for ffmpeg/v4l2-ctl, improved module reload logic
- test/helpers.go - Changed exclusive_caps=1 to 0 for shared device access
See test/README.md for detail
Documentation updates:
- README.md - Added GetFrames() example and performance comparison
- ROADMAP.md - Marked frame metadata and performance optimization phases as complete
- TESTING_GUIDE.md - Added frame pool benchmarks section
API Deprecation
Marked GetOutput() as deprecated with clear migration guidance:
// Deprecated: Use GetFrames() instead. GetFrames() provides the same functionality
// with significantly better performance through buffer pooling, using 540x less memory
// (1 KB vs 614 KB per frame) and reducing GC pressure. This method will be removed
// in a future version.
What's Changed
- issue #82 - Implement API for safer/performant frame capture by @vladimirvivien in #83
Full Changelog: v0.1.0...v0.2.0