We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 366a6bd commit ef080c2Copy full SHA for ef080c2
samples/drivers/video/tcpserversink/src/main.c
@@ -95,9 +95,17 @@ int main(void)
95
return 0;
96
}
97
98
+ /* Alloc Buffers */
99
+ size_t buffer_size;
100
+ if (video_bits_per_pixel(fmt.pixelformat) > 0) {
101
+ buffer_size = fmt.pitch * fmt.height;
102
+ } else {
103
+ buffer_size = fmt.width * fmt.height / 10;
104
+ }
105
+
106
/* Alloc Buffers */
107
for (i = 0; i < ARRAY_SIZE(buffers); i++) {
- buffers[i] = video_buffer_alloc(fmt.pitch * fmt.height, K_FOREVER);
108
+ buffers[i] = video_buffer_alloc(buffer_size, K_FOREVER);
109
if (buffers[i] == NULL) {
110
LOG_ERR("Unable to alloc video buffer");
111
0 commit comments