From 8db85cf19897085e82dbfb9a3e36e7122a695cc7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 8 Dec 2022 13:38:59 +0100 Subject: [PATCH] examples: handle 0 stride better Assume the stride is size/height in case someone doesn't set the stride correctly. --- src/examples/video-dsp-play.c | 2 ++ src/examples/video-play-fixate.c | 2 ++ src/examples/video-play-pull.c | 2 ++ src/examples/video-play-reneg.c | 2 ++ src/examples/video-play.c | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/examples/video-dsp-play.c b/src/examples/video-dsp-play.c index 71f9b0199..6068e2a0f 100644 --- a/src/examples/video-dsp-play.c +++ b/src/examples/video-dsp-play.c @@ -139,6 +139,8 @@ on_process(void *_data, struct spa_io_position *position) /* copy video image in texture */ sstride = buf->datas[0].chunk->stride; + if (sstride == 0) + sstride = buf->datas[0].chunk->size / data->position->video.size.height; src = sdata; dst = ddata; diff --git a/src/examples/video-play-fixate.c b/src/examples/video-play-fixate.c index 021eb0df5..7477c5a06 100644 --- a/src/examples/video-play-fixate.c +++ b/src/examples/video-play-fixate.c @@ -257,6 +257,8 @@ on_process(void *_data) /* copy video image in texture */ sstride = buf->datas[0].chunk->stride; + if (sstride == 0) + sstride = buf->datas[0].chunk->size / data->size.height; ostride = SPA_MIN(sstride, dstride); src = sdata; diff --git a/src/examples/video-play-pull.c b/src/examples/video-play-pull.c index 807677962..fd0e30589 100644 --- a/src/examples/video-play-pull.c +++ b/src/examples/video-play-pull.c @@ -206,6 +206,8 @@ on_process(void *_data) } sstride = buf->datas[0].chunk->stride; + if (sstride == 0) + sstride = buf->datas[0].chunk->size / data->size.height; ostride = SPA_MIN(sstride, dstride); src = sdata; diff --git a/src/examples/video-play-reneg.c b/src/examples/video-play-reneg.c index f37b66285..26b19cb59 100644 --- a/src/examples/video-play-reneg.c +++ b/src/examples/video-play-reneg.c @@ -136,6 +136,8 @@ on_process(void *_data) /* copy video image in texture */ sstride = buf->datas[0].chunk->stride; + if (sstride == 0) + sstride = buf->datas[0].chunk->size / data->size.height; ostride = SPA_MIN(sstride, dstride); src = sdata; diff --git a/src/examples/video-play.c b/src/examples/video-play.c index 61c3114f7..9cbbab698 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -204,6 +204,8 @@ on_process(void *_data) } sstride = buf->datas[0].chunk->stride; + if (sstride == 0) + sstride = buf->datas[0].chunk->size / data->size.height; ostride = SPA_MIN(sstride, dstride); src = sdata;