Ticket #2073: NVR_V4L2_reset_capture_buffers.diff
File NVR_V4L2_reset_capture_buffers.diff, 2.4 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/NuppelVideoRecorder.cpp
1365 1365 1366 1366 encoding = true; 1367 1367 recording = true; 1368 resetcapture = false; 1368 1369 1369 while (encoding) {1370 again: 1370 while (encoding) 1371 { 1371 1372 if (request_pause) 1372 1373 { 1373 1374 mainpaused = true; … … 1382 1383 } 1383 1384 mainpaused = false; 1384 1385 1385 if (resetcapture && go7007)1386 if (resetcapture) 1386 1387 { 1387 int turnon = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1388 VERBOSE(VB_IMPORTANT, LOC + "Reset and requeue capture buffers."); 1389 turnon = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1388 1390 ioctl(fd, VIDIOC_STREAMOFF, &turnon); 1389 1391 1390 1392 for (int i = 0; i < numbuffers; i++) … … 1407 1409 switch (select(fd+1, &rdset, NULL, NULL, &tv)) 1408 1410 { 1409 1411 case -1: 1410 if (errno == EINTR) 1411 goto again; 1412 perror("select"); 1413 continue; 1412 if (errno != EINTR) 1413 perror("select"); 1414 continue; 1414 1415 case 0: 1415 1416 1417 default: break;1416 printf("select timeout\n"); 1417 continue; 1418 default: break; 1418 1419 } 1419 1420 1420 1421 memset(&vbuf, 0, sizeof(vbuf)); … … 1423 1424 if (ioctl(fd, VIDIOC_DQBUF, &vbuf) < 0) 1424 1425 { 1425 1426 perror("VIDIOC_DQBUF"); 1426 if (errno == -EINVAL)1427 switch(errno) 1427 1428 { 1428 for (int i = 0; i < numbuffers; i++) 1429 { 1430 vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1431 vbuf.index = i; 1432 ioctl(fd, VIDIOC_QBUF, &vbuf); 1433 } 1434 continue; 1429 case EINVAL: 1430 case EIO: 1431 resetcapture = true; 1432 case EAGAIN: 1433 continue; 1434 default: break; 1435 1435 } 1436 1436 } 1437 1437 … … 2855 2855 positionMapDelta.clear(); 2856 2856 positionMapLock.unlock(); 2857 2857 2858 resetcapture = true; 2858 if (go7007) 2859 resetcapture = true; 2859 2860 } 2860 2861 2861 2862 void NuppelVideoRecorder::StartNewFile(void)