Comments (2)
I am currently running it on a beaglebone black, and sometimes it runs fine, but sometimes it does segfault. I ran gdb on it and it seems like its crashing in a call libusb. It crashes in uvc_stop_streaming call.
from libuvc.
It seems I've had the same trouble - my app using libuvc crashes when trying to close device with uvc_close() after starting a stream with uvc_stream_start().
The actual problem was in function called uvc_stream_stop - there is erroneous usage of libusb_cancel_transfer return value:
int res = libusb_cancel_transfer(strmh->transfers[i]); if(res < 0) { free(strmh->transfers[i]->buffer); libusb_free_transfer(strmh->transfers[i]); strmh->transfers[i] = NULL; }
It is not valid to free transfer immediately after libusb_cancel_transfer returned negative result cause this transfer may still be used in uvc_iso_callback function.
So I commented out transfer freeing code in uvc_stream_stop and add transfer deletion to uvc_iso_callback for LIBUSB_TRANSFER_COMPLETED, LIBUSB_TRANSFER_TIMED_OUT, LIBUSB_TRANSFER_STALL and LIBUSB_TRANSFER_OVERFLOW cases.
Of course transfer deletion in uvc_iso_callback for these cases should happen only when strmh->running == 0.
I'm not sure if this quick and dirty solution is the best one, but it works for me - no more crashes when calling uvc_close(). My current version of stream.c is attached.
stream.zip
from libuvc.
Related Issues (20)
- Struct timeval vs struct timespec, is it a typo?
- uvc_test shared library not generating HOT 5
- Tests fail to compile: error: "OpenCV 4.x+ requires enabled C++11 support" HOT 1
- LibUVC on Linux disconnects the camera when I write any UVC camera control command like exposure or PTZ (Pan, Tilt & Zoom)
- Corrupted images
- Using EndpointHalt to Stop UVC Bulk Mode Transfer HOT 4
- "Current" way for building libuvc for Android HOT 2
- Non-deterministic crash on uvc_close on Non-Rooted Android HOT 1
- Can't reopen stream without recreating context on non-rooted Android HOT 4
- Creating Virtual Devices
- window libuvc supports streaming_maxpacket and streaming_maxburst settings?
- libuvc supports rgb888?
- How do composite devices support two channels to play video HOT 2
- libuvc stream_get_frame fails on ELP 2M USB camera HOT 2
- uvc_frame_t->source is set to null
- endpoint_bytes_per_packet calculation for Superspeed endpoint
- question about vertical lines
- example: os/threads_posix.h:58: usbi_mutex_destroy: Assertion `pthread_mutex_destroy(mutex) == 0' failed. HOT 5
- Camera Fails to set dwMaxPayloadTransferSize on UVC_GET_MAX
- preview of uvc camera is flickering by Android HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libuvc.