Hello, Yes I have used the aravis examples and it worked very well until yesterday^^. I work on a distant linux pc which is connected to a basler camera and dmk camera (DMK23G445). This pc runs my program. Arv-viewer works well with the DMK camera, but i'm not sure for the basler camera ( I get arv-viewer's windows from a distant pc). I have not lot informations with arv-viewer to see if a grab failed but i think it failed because I can't get new frames if I play with exposure or gain (with the dmk, it works). With my program, the continuous grab seems to works with dmk. My arv-buffer doesn't get a null value. But with the basler, my arv-buffer get a NULL value after 1000 or 2000 frames, it depends. Is that merely a connection problem ? Both cameras are connected to a gigabit switch. Thank you, Y.A 2015-01-22 12:35 GMT+01:00 Patrick Doyle <wpdster@xxxxxxxxx>: > This looks a lot like code from the Aravis examples and/or viewer > directories, which is great! I wish I had thought to look at that > code when I first started playing with Aravis. > > Does your camera work with arvviewer? Or does it eventually timeout > and fail as you describe even with the viewer? > > --wpd > > > On Wed, Jan 21, 2015 at 2:33 PM, Yoan Audureau <yoan.audureau@xxxxxxxxx> > wrote: > > > > Hello, > > > > I am a new user of aravis for a basler camera acA1300-30gm. > > I have some difficulties to grab frames continuously from this camera. > > In fact, it works to grab frames but at a moment my ArvBuffer get a NULL > > value (arv_buffer = arv_stream_timeout_pop_buffer(stream, 2000000)). And > > after that, the following grabs also all failed. I don't really > understand > > why arv_stream_timeout_pop_buffer returns a NULL value at "random" time. > > Could anyone help me find my mistake ? > > > > Here is the code grouped in different functions. ArvBuffer is in > > CameraSDKAravis::grabImage(Frame &newFrame). > > I call this function in a loop. > > > > Thank you, > > > > Yoan > > > > bool CameraSDKAravis::grabStart(){ > > > > payload = arv_camera_get_payload (camera); > > > > arv_camera_get_region (camera, NULL, NULL, &width, &height); > > > > pixFormat = arv_camera_get_pixel_format (camera); > > > > arv_camera_get_exposure_time_bounds (camera, &exposureMin, > > &exposureMax); > > > > arv_camera_get_gain_bounds (camera, &gainMin, &gainMax); > > > > arv_camera_set_frame_rate (camera, 30); > > > > fps = arv_camera_get_frame_rate(camera); > > > > caps_string = arv_pixel_format_to_gst_caps_string(pixFormat); > > > > gain = arv_camera_get_gain(camera); > > exp = arv_camera_get_exposure_time(camera); > > > > cout << endl; > > > > cout << "DEVICE SELECTED : " << arv_camera_get_device_id(camera) > << > > endl; > > cout << "DEVICE NAME : " << arv_camera_get_model_name(camera) > << > > endl; > > cout << "DEVICE VENDOR : " << arv_camera_get_vendor_name(camera) > << > > endl; > > cout << "PAYLOAD : " << payload > << > > endl; > > cout << "Width : " << width > << > > endl > > << "Height : " << height > << > > endl; > > cout << "Exp Range : [" << exposureMin << " - " << > exposureMax > > << "]" << endl; > > cout << "Exp : " << exp > << > > endl; > > cout << "Gain Range : [" << gainMin << " - " << gainMax > > << "]" << endl; > > cout << "Gain : " << gain > << > > endl; > > cout << "Fps : " << fps > << > > endl; > > cout << "Type : " << caps_string > << > > endl; > > > > cout << endl; > > > > // Create a new stream object. Open stream on Camera. > > stream = arv_camera_create_stream(camera, NULL, NULL); > > > > if (ARV_IS_GV_STREAM(stream)){ > > > > bool arv_option_auto_socket_buffer = true; > > bool arv_option_no_packet_resend = true; > > unsigned int arv_option_packet_timeout = 20; > > unsigned int arv_option_frame_retention = 100; > > > > if(arv_option_auto_socket_buffer){ > > > > g_object_set(stream, > > "socket-buffer", > ARV_GV_STREAM_SOCKET_BUFFER_AUTO, > > "socket-buffer-size", 0, NULL); > > > > } > > > > if(arv_option_no_packet_resend){ > > > > g_object_set(stream, "packet-resend", > > ARV_GV_STREAM_PACKET_RESEND_NEVER, NULL); > > > > } > > > > g_object_set(stream, "packet-timeout", (unsigned)200000, > > "frame-retention", (unsigned) 10000000,NULL); > > > > } > > > > // Push 50 buffer in the stream input buffer queue. > > for (int i = 0; i < 50; i++) > > arv_stream_push_buffer(stream, arv_buffer_new(payload, NULL)); > > > > return true; > > > > } > > > > void CameraSDKAravis::acqStart(bool continuousAcquisition){ > > > > if(continuousAcquisition) > > arv_camera_set_acquisition_mode(camera, > > ARV_ACQUISITION_MODE_CONTINUOUS); > > else > > arv_camera_set_acquisition_mode(camera, > > ARV_ACQUISITION_MODE_SINGLE_FRAME); > > > > arv_camera_start_acquisition(camera); > > > > } > > > > void CameraSDKAravis::acqStop(){ > > > > arv_stream_get_statistics(stream, &n_completed_buffers, &n_failures, > > &n_underruns); > > > > cout << "Completed buffers = " << (unsigned long long) > > n_completed_buffers << endl; > > cout << "Failures = " << (unsigned long long) n_failures > > << endl; > > cout << "Underruns = " << (unsigned long long) n_underruns > > << endl; > > > > arv_camera_stop_acquisition(camera); > > > > g_object_unref(stream); > > g_object_unref(camera); > > > > } > > > > bool CameraSDKAravis::grabImage(Frame &newFrame){ > > > > ArvBuffer *arv_buffer; > > > > arv_buffer = arv_stream_timeout_pop_buffer(stream, 2000000); //us > > > > if (arv_buffer == NULL){ > > g_usleep (100000); > > // throw runtime_error("arv_buffer is NULL"); > > return false; > > > > }else{ > > > > if (arv_buffer->status == ARV_BUFFER_STATUS_SUCCESS){ > > > > //Timestamping. > > string acquisitionDate = > > > TimeDate::localDateTime(second_clock::universal_time(),"%Y:%m:%d:%H:%M:%S"); > > > > Mat image; > > > > if(pixFormat == ARV_PIXEL_FORMAT_MONO_8){ > > > > Mat img(height, width, CV_8UC1, arv_buffer->data); > > img.copyTo(image); > > > > }else if(pixFormat == ARV_PIXEL_FORMAT_MONO_12){ > > > > Mat img(height, width, CV_16UC1, arv_buffer->data); > > img.copyTo(image); > > > > } > > > > newFrame = Frame(image, arv_camera_get_gain(camera), > > arv_camera_get_exposure_time(camera), acquisitionDate); > > > > }else{ > > > > switch(arv_buffer->status){ > > > > case 0 : > > cout << "ARV_BUFFER_STATUS_SUCCESS : the buffer > contains > > a valid image"<<endl; > > break; > > case 1 : > > cout << "ARV_BUFFER_STATUS_CLEARED: the buffer is > > cleared"<<endl; > > break; > > case 2 : > > cout << "ARV_BUFFER_STATUS_TIMEOUT: timeout was > reached > > before all packets are received"<<endl; > > break; > > case 3 : > > cout << "ARV_BUFFER_STATUS_MISSING_PACKETS: stream > has > > missing packets"<<endl; > > break; > > case 4 : > > cout << "ARV_BUFFER_STATUS_WRONG_PACKET_ID: stream > has > > packet with wrong id"<<endl; > > break; > > case 5 : > > cout << "ARV_BUFFER_STATUS_SIZE_MISMATCH: the > received > > image didn't fit in the buffer data space"<<endl; > > break; > > case 6 : > > cout << "ARV_BUFFER_STATUS_FILLING: the image is > > currently being filled"<<endl; > > break; > > case 7 : > > cout << "ARV_BUFFER_STATUS_ABORTED: the filling was > > aborted before completion"<<endl; > > break; > > > > } > > > > return false; > > } > > > > arv_stream_push_buffer(stream, arv_buffer); > > > > } > > > > return true; > > } > > > > -- Audureau Yoan