Comments (2)
i just ran into the same issue.
running a git bisect
between v0.12.7
and current HEAD
also shows that the mentioned commit is the culprit.
i then tested with a revert-commit and the problem goes away.
this is the revert-patch:
diff --git a/v4l2loopback.c b/v4l2loopback.c
index 2ab1f76..2514f09 100644
--- a/v4l2loopback.c
+++ b/v4l2loopback.c
@@ -92,17 +92,6 @@ MODULE_LICENSE("GPL");
} \
} while (0)
-/* TODO: Make sure that function is never interrupted. */
-static inline int mod_inc(int *number, int mod)
-{
- int result;
- result = (*number + 1) % mod;
- if (unlikely(result < 0))
- result += mod;
- *number = result;
- return result;
-}
-
static inline void v4l2l_get_timestamp(struct v4l2_buffer *b)
{
/* ktime_get_ts is considered deprecated, so use ktime_get_ts64 if possible */
@@ -1424,8 +1413,9 @@ static int vidioc_reqbufs(struct file *file, void *fh,
i = dev->write_position;
list_for_each_entry(pos, &dev->outbufs_list,
list_head) {
- dev->bufpos2index[mod_inc(&i, b->count)] =
+ dev->bufpos2index[i % b->count] =
pos->buffer.index;
+ ++i;
}
}
@@ -1489,9 +1479,10 @@ static void buffer_written(struct v4l2_loopback_device *dev,
del_timer_sync(&dev->timeout_timer);
spin_lock_bh(&dev->lock);
- dev->bufpos2index[mod_inc(&dev->write_position, dev->used_buffers)] =
+ dev->bufpos2index[dev->write_position % dev->used_buffers] =
buf->buffer.index;
list_move_tail(&buf->list_head, &dev->outbufs_list);
+ ++dev->write_position;
dev->reread_count = 0;
check_timers(dev);
@@ -1586,7 +1577,8 @@ static int get_capture_buffer(struct file *file)
if (dev->write_position >
opener->read_position + dev->used_buffers)
opener->read_position = dev->write_position - 1;
- pos = mod_inc(&opener->read_position, dev->used_buffers);
+ pos = opener->read_position % dev->used_buffers;
+ ++opener->read_position;
}
timeout_happened = dev->timeout_happened;
dev->timeout_happened = 0;
from v4l2loopback.
i just ran into the same issue. running a
git bisect
betweenv0.12.7
and currentHEAD
also shows that the mentioned commit is the culprit. i then tested with a revert-commit and the problem goes away.
It seems that, the base code depends heavily on read_position and write_position.
If modulo operation applied on the two variables, it is hard to judge if (write_position > read_position) is true.
So, as you see, my patch just increase the input number, but returns a modulo value. But it is strange to read the code.
from v4l2loopback.
Related Issues (20)
- Failed to stream H264 to virtual camera: "does not support 2:4:7:1 colorimetry" HOT 3
- Devices limited to 8 even with KCPP flag HOT 1
- Chromium cannot read camera: Dequeued v4l2 buffer contains invalid length HOT 5
- DKMS Won't Sign When Building HOT 3
- Dummy device made via v4l2loopback is busy HOT 6
- wont compile on 32bit armv7l HOT 3
- Caught SIGSEGV
- DKMS fails to build against 6.8-rc1 kernel due to use of strlcpy
- can't increase Read/Write buffers from 2 to 4 HOT 1
- resolution 2048x1 does not work HOT 5
- Fails to build against Kernel 6.8-rc6 HOT 3
- dkms build fails on kernel version >6.8.0 HOT 7
- Possible Missing Dependency? HOT 5
- getNextFrame no data errno:0 Success HOT 1
- getNextFrame no data errno:0 Success on v4l2rtspserver log with verbose HOT 2
- how create duplicate device0 and /dev/video1 who desn't have "Video Capture"? HOT 5
- modprobe: ERROR: could not insert 'v4l2loopback': Exec format error HOT 3
- Linux 6.8.4 seems to have broken v4l2loopback in several ways. HOT 6
- Linux 6.8.4 seems to have broken v4l2loopback in several ways.
- [Bug]: Can't create second device HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v4l2loopback.