Changeset 392a5a40770759eb8b350a838e8766adace52316
- Timestamp:
- 27/04/04 11:28:25
(4 years ago)
- Author:
- Sam Hocevar <sam@videolan.org>
- git-committer:
- Sam Hocevar <sam@videolan.org> 1083058105 +0000
- git-parent:
[5ba84a43aab674f0946af0a1c06190677a6a8c73]
- git-author:
- Sam Hocevar <sam@videolan.org> 1083058105 +0000
- Message:
- modules/access/v4l/v4l.c:
+ Fixed possible deadlocks.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r753e14b |
r392a5a4 |
|
| 1293 | 1293 | |
|---|
| 1294 | 1294 | p_sys->vid_mmap.frame = (p_sys->i_frame_pos + 1) % p_sys->vid_mbuf.frames; |
|---|
| 1295 | | for( ;; ) |
|---|
| 1296 | | { |
|---|
| 1297 | | if( ioctl( p_sys->fd_video, VIDIOCMCAPTURE, &p_sys->vid_mmap ) >= 0 ) |
|---|
| 1298 | | { |
|---|
| 1299 | | break; |
|---|
| 1300 | | } |
|---|
| 1301 | | |
|---|
| | 1295 | |
|---|
| | 1296 | while( ioctl( p_sys->fd_video, VIDIOCMCAPTURE, &p_sys->vid_mmap ) < 0 ) |
|---|
| | 1297 | { |
|---|
| 1302 | 1298 | if( errno != EAGAIN ) |
|---|
| 1303 | 1299 | { |
|---|
| 1304 | | msg_Err( p_input, "failed while grabbing new frame" ); |
|---|
| 1305 | | return( NULL ); |
|---|
| 1306 | | } |
|---|
| 1307 | | msg_Dbg( p_input, "another try ?" ); |
|---|
| 1308 | | } |
|---|
| 1309 | | |
|---|
| 1310 | | while( ioctl(p_sys->fd_video, VIDIOCSYNC, &p_sys->i_frame_pos) < 0 && |
|---|
| 1311 | | ( errno == EAGAIN || errno == EINTR ) ); |
|---|
| | 1300 | msg_Err( p_input, "failed capturing new frame" ); |
|---|
| | 1301 | return NULL; |
|---|
| | 1302 | } |
|---|
| | 1303 | |
|---|
| | 1304 | if( p_input->b_die ) |
|---|
| | 1305 | { |
|---|
| | 1306 | return NULL; |
|---|
| | 1307 | } |
|---|
| | 1308 | |
|---|
| | 1309 | msg_Dbg( p_input, "grab failed, trying again" ); |
|---|
| | 1310 | } |
|---|
| | 1311 | |
|---|
| | 1312 | while( ioctl(p_sys->fd_video, VIDIOCSYNC, &p_sys->i_frame_pos) < 0 ) |
|---|
| | 1313 | { |
|---|
| | 1314 | if( errno != EAGAIN && errno != EINTR ) |
|---|
| | 1315 | { |
|---|
| | 1316 | msg_Err( p_input, "failed syncing new frame" ); |
|---|
| | 1317 | return NULL; |
|---|
| | 1318 | } |
|---|
| | 1319 | } |
|---|
| 1312 | 1320 | |
|---|
| 1313 | 1321 | p_sys->i_frame_pos = p_sys->vid_mmap.frame; |
|---|
| … | … | |
| 1327 | 1335 | /* re-queue the last frame we sync'd */ |
|---|
| 1328 | 1336 | if( p_sys->i_frame_pos != -1 ) |
|---|
| 1329 | | while( ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT, &p_sys->i_frame_pos ) < 0 && |
|---|
| 1330 | | ( errno == EAGAIN || errno == EINTR ) ); |
|---|
| | 1337 | { |
|---|
| | 1338 | while( ioctl( p_sys->fd_video, MJPIOC_QBUF_CAPT, |
|---|
| | 1339 | &p_sys->i_frame_pos ) < 0 ) |
|---|
| | 1340 | { |
|---|
| | 1341 | if( errno != EAGAIN && errno != EINTR ) |
|---|
| | 1342 | { |
|---|
| | 1343 | msg_Err( p_input, "failed capturing new frame" ); |
|---|
| | 1344 | return NULL; |
|---|
| | 1345 | } |
|---|
| | 1346 | } |
|---|
| | 1347 | } |
|---|
| 1331 | 1348 | |
|---|
| 1332 | 1349 | /* sync on the next frame */ |
|---|
| 1333 | | while( ioctl( p_sys->fd_video, MJPIOC_SYNC, &sync ) < 0 && |
|---|
| 1334 | | ( errno == EAGAIN || errno == EINTR ) ); |
|---|
| | 1350 | while( ioctl( p_sys->fd_video, MJPIOC_SYNC, &sync ) < 0 ) |
|---|
| | 1351 | { |
|---|
| | 1352 | if( errno != EAGAIN && errno != EINTR ) |
|---|
| | 1353 | { |
|---|
| | 1354 | msg_Err( p_input, "failed syncing new frame" ); |
|---|
| | 1355 | return NULL; |
|---|
| | 1356 | } |
|---|
| | 1357 | } |
|---|
| 1335 | 1358 | |
|---|
| 1336 | 1359 | p_sys->i_frame_pos = sync.frame; |
|---|