Re: [libdc1394-devel] dc1394_cleanup_iso_channels_and_bandwidth
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: David M. <dcm@MIT.EDU> - 2006-12-20 23:33:16
|
A few things: 1. If you call dc1394_video_set_transmission(cameras[i], DC1394_OFF) before you call dc1394_capture_stop(), the bandwidth and channel should be freed automatically, and you should not need to call any raw1394_* functions. 2. The raw1394_* code you've got here will in fact free all iso bandwidth related to all devices on the bus, not just the one camera. In fact, it will do that numCameras times. This is because "Port" refers to the firewire controller on your machine, not a specific device. 3. Admittedly, this kind of code is difficult and error prone to write. libdc1394 should be producing ample warnings if functions are called in the wrong order. It shouldn't be this complicated. See my next email. -David On Wed, 2006-12-20 at 11:07 -0600, Jon Schewe wrote: > Here's the cleanup function that I'm using and seems to work rather > well: > /* helper functions */ > void cleanup(void) { > raw1394handle_t handle = raw1394_new_handle (); > logger(LOG_DEBUG, "CAMERA", "Cleaning up"); > for (int i=0; i < numCameras; i++) { > // cleanup the dc1394 resources > dc1394_capture_stop(cameras[i]); > dc1394_video_set_transmission(cameras[i], DC1394_OFF); > > // free up the raw1394 resources > if (raw1394_set_port (handle, cameras[i]->port) < 0) { > logger(LOG_ERROR, "CAMERA", "Failed to set port to %d", i); > } else { > for (int j = 0; j < 64; j++) { > raw1394_channel_modify (handle, j, RAW1394_MODIFY_FREE); > } > raw1394_bandwidth_modify (handle, MAXIMUM_BANDWIDTH, > RAW1394_MODIFY_FREE); > } > raw1394_destroy_handle (handle); > > } > } > > > On Wed, 2006-12-20 at 12:58 -0400, Alvin wrote: > > Hello, > > > > I removed my call to dc1394_cleanup_iso_channels_and_bandwidth() as suggested > > by this list. > > > > But, now, every 3rd or 4th attempt to use the camera fails with a message > > similar to "unable to allocate bandwidth". The 3 or 4 times it takes for this > > to occur makes sense because my Basler A601f camera uses about 30% of the > > bandwidth. > > > > The only workaround is to disconnect the camera and plug it back in. After I > > do that, it takes another 3 or 4 times for that error message to appear. > > > > This error message occurs not because of a segfault, I cleaning exit the app. > > I have made sure that caputring is stopped, that transmittion has stopped > > (while-loop check as in the examples) and that dc1394_free_camera() is > > called. > > > > Is there something else I could do, using libdc1394 or libraw1394, to make > > sure that the resources have been released? > > > > Thanks, > > > > Alvin > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Mailing list for libdc1394-devel > > lib...@li... > > https://lists.sourceforge.net/lists/listinfo/libdc1394-devel > > ________________________________________________________________________ > http://lug.htc.honeywell.com/people/jschewe [Honeywell Intranet Only] > *My views may not represent those of my employers > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Mailing list for libdc1394-devel > lib...@li... > https://lists.sourceforge.net/lists/listinfo/libdc1394-devel |