Configure fewer frames per channel by default

The number of frame stores / frame buffers can't be used like this as
the actual number of frames that can be used also depends on the
resolution.

If too many frames are used and the card's memory runs full, strange
problems (green frames, channels leaking into each other, etc.) will
appear.

As such, configure 8 frames for the source by default and half the queue
length for the sink. If anything else is needed, manual configuration
via the properties has to happen based on the expected workload on all
channels and the characteristics of the card in use.
This commit is contained in:
Sebastian Dröge 2021-11-01 16:12:05 +02:00
parent e2f1953fa7
commit bfdf93ecd1
2 changed files with 10 additions and 16 deletions

View file

@ -1737,16 +1737,13 @@ restart:
guint16 start_frame = self->start_frame;
guint16 end_frame = self->end_frame;
// If nothing was configured, work with a number of frames that is half
// the queue size and assume that all other channels work the same.
if (start_frame == end_frame) {
guint16 num_frames = ::NTV2DeviceGetNumberFrameBuffers(self->device_id);
guint16 num_channels = ::NTV2DeviceGetNumFrameStores(self->device_id);
guint16 num_frames = self->queue_size / 2;
start_frame = self->channel * (num_frames / num_channels);
end_frame = ((self->channel + 1) * (num_frames / num_channels)) - 1;
// Don't configure too many frames here. It needs to be in relation to
// our input queue.
end_frame = MIN(start_frame + self->queue_size / 2, end_frame);
start_frame = self->channel * num_frames;
end_frame = (self->channel + 1) * num_frames - 1;
}
GST_DEBUG_OBJECT(

View file

@ -1781,16 +1781,13 @@ restart:
guint16 start_frame = self->start_frame;
guint16 end_frame = self->end_frame;
// If nothing was configured, work with 8 frames and assume that all
// other channels work the same.
if (start_frame == end_frame) {
guint16 num_frames = ::NTV2DeviceGetNumberFrameBuffers(self->device_id);
guint16 num_channels = ::NTV2DeviceGetNumFrameStores(self->device_id);
guint start_channel = self->channel;
guint end_channel = self->channel + 1;
const guint16 num_frames = 8;
if (self->quad_mode) end_channel = self->channel + 4;
start_frame = start_channel * (num_frames / num_channels);
end_frame = (end_channel * (num_frames / num_channels)) - 1;
start_frame = self->channel * num_frames;
end_frame = (self->channel + 1) * num_frames - 1;
}
GST_DEBUG_OBJECT(