-
-
Notifications
You must be signed in to change notification settings - Fork 404
Wip/gv underrun fixes #1009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Wip/gv underrun fixes #1009
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -123,6 +123,7 @@ typedef struct { | |||||||||||
| gboolean resend_ratio_reached; | ||||||||||||
|
|
||||||||||||
| gboolean extended_ids; | ||||||||||||
| gboolean underrun; | ||||||||||||
| } ArvGvStreamFrameData; | ||||||||||||
|
Comment on lines
125
to
127
|
||||||||||||
|
|
||||||||||||
| struct _ArvGvStreamThreadData { | ||||||||||||
|
|
@@ -162,6 +163,8 @@ struct _ArvGvStreamThreadData { | |||||||||||
|
|
||||||||||||
| gboolean use_packet_socket; | ||||||||||||
|
|
||||||||||||
| guint64 underrun_frame_id; | ||||||||||||
|
|
||||||||||||
|
Comment on lines
165
to
+167
|
||||||||||||
| /* Statistics */ | ||||||||||||
|
|
||||||||||||
| guint64 n_completed_buffers; | ||||||||||||
|
|
@@ -374,8 +377,10 @@ _find_frame_data (ArvGvStreamThreadData *thread_data, | |||||||||||
|
|
||||||||||||
| buffer = arv_stream_pop_input_buffer (thread_data->stream); | ||||||||||||
| if (buffer == NULL) { | ||||||||||||
| thread_data->n_underruns++; | ||||||||||||
|
|
||||||||||||
| if (thread_data->underrun_frame_id != frame_id) { | ||||||||||||
| thread_data->n_underruns++; | ||||||||||||
| thread_data->underrun_frame_id = frame_id; | ||||||||||||
| } | ||||||||||||
|
Comment on lines
377
to
+383
|
||||||||||||
| return NULL; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -389,11 +394,13 @@ _find_frame_data (ArvGvStreamThreadData *thread_data, | |||||||||||
| thread_data->callback (thread_data->callback_data, | ||||||||||||
| ARV_STREAM_CALLBACK_TYPE_BUFFER_DONE, | ||||||||||||
| buffer); | ||||||||||||
| thread_data->underrun_frame_id = 0; | ||||||||||||
| return NULL; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| frame = g_new0 (ArvGvStreamFrameData, 1); | ||||||||||||
|
|
||||||||||||
| frame->underrun = thread_data->underrun_frame_id == frame_id; | ||||||||||||
| frame->disable_resend_request = FALSE; | ||||||||||||
|
|
||||||||||||
| frame->frame_id = frame_id; | ||||||||||||
|
|
@@ -432,6 +439,8 @@ _find_frame_data (ArvGvStreamThreadData *thread_data, | |||||||||||
|
|
||||||||||||
| arv_histogram_fill (thread_data->histogram, 1, 0); | ||||||||||||
|
|
||||||||||||
| thread_data->underrun_frame_id = 0; | ||||||||||||
|
|
||||||||||||
| return frame; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -834,7 +843,9 @@ _check_frame_completion (ArvGvStreamThreadData *thread_data, | |||||||||||
| * acquisition start. */ | ||||||||||||
| (frame->frame_id != thread_data->last_frame_id || frame->last_valid_packet != 0) && | ||||||||||||
| time_us - frame->last_packet_time_us >= thread_data->frame_retention_us) { | ||||||||||||
| frame->buffer->priv->status = ARV_BUFFER_STATUS_TIMEOUT; | ||||||||||||
| frame->buffer->priv->status = frame->underrun ? | ||||||||||||
| ARV_BUFFER_STATUS_UNDERRUN : | ||||||||||||
|
Comment on lines
845
to
+847
|
||||||||||||
| ARV_BUFFER_STATUS_TIMEOUT; | ||||||||||||
| arv_warning_stream_thread ("[GvStream::check_frame_completion] Timeout for frame %" | ||||||||||||
| G_GUINT64_FORMAT " at dt = %" G_GUINT64_FORMAT, | ||||||||||||
|
Comment on lines
849
to
850
|
||||||||||||
| arv_warning_stream_thread ("[GvStream::check_frame_completion] Timeout for frame %" | |
| G_GUINT64_FORMAT " at dt = %" G_GUINT64_FORMAT, | |
| arv_warning_stream_thread ("[GvStream::check_frame_completion] %s for frame %" | |
| G_GUINT64_FORMAT " at dt = %" G_GUINT64_FORMAT, | |
| frame->underrun ? "Underrun" : "Timeout", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
ARV_BUFFER_STATUS_UNDERRUNdocstring is a bit ambiguous about what condition triggers it. The implementation sets it when no input buffer was available for the frame at some point (buffer underrun) and the frame later hits the retention timeout; consider rewording to reflect that specific trigger so API users can distinguish it from network/packet-loss timeouts.