Date: Sun, 09 Feb 2003 19:47:59 -0500 (EST) From: Andriy Gapon <avg@icyb.net.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/48126: transcode -M2 doesn't properly work for DVD->SVCD conversion Message-ID: <20030209194701.S51046@edge.foundation.invalid>
next in thread | raw e-mail | index | archive | help
>Number: 48126 >Category: ports >Synopsis: transcode -M2 doesn't properly work for DVD->SVCD conversion >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 09 16:50:21 PST 2003 >Closed-Date: >Last-Modified: >Originator: Andriy Gapon >Release: FreeBSD 4.7-RELEASE-p3 i386 >Organization: >Environment: System: FreeBSD edge.foundation.invalid 4.7-RELEASE-p3 FreeBSD 4.7-RELEASE-p3 #0: Mon Feb 3 00:42:39 EST 2003 avg@edge.foundation.invalid:/sys-devel/obj/sys-devel/src/sys/EDGE i386 transcode-0.6.3 >Description: due to specifics of FreeBSD pthreads implementation transcode doesn't work properly with -M 2 (and probably higher) option. The problems manifest themselves as either (a) transcode "hang" (no work, no CPU utilization) or (b) transcode exits and "completes work" too early. >How-To-Repeat: try to transcode a long DVD movie to mpeg2 (svcd) using -M 2 option >Fix: symptome (a) is caused by the way libc_r handles file descriptors at execve(), basically after forking a new process the whole parent process would block and read()/write() instead of just a single thread. See http://www.freebsd.org/cgi/query-pr.cgi?pr=standards/43335 for details. clone.c part of the patch below should help those who have lib/libc_r/uthread/uthread_execve.c version 1.11.2.6 for 4.X or 1.16 for 5.X it will not make any difference for those who have earlier libc_r symptome (b) results from delivery of a signal to a process for thread context switch. In this situation read()/write() operation on a fifo may return EINTR, normally opeartion should be retried in this situation, but transcode would treat it as an error. ioaux.c part of patch should help with that. --- patch-pipe-io-new begins here --- --- import/ioaux.c.orig Sun Feb 9 19:05:12 2003 +++ import/ioaux.c Sun Feb 9 19:05:29 2003 @@ -36,8 +36,14 @@ while (r < len) { n = read (fd, buf + r, len - r); - if (n <= 0) - return r; + if (n == 0) + break; + if (n < 0) { + if (errno == EINTR) + continue; + else + break; + } r += n; } @@ -51,9 +57,12 @@ while (r < len) { n = write (fd, buf + r, len - r); - if (n < 0) - return n; - + if (n < 0) { + if (errno == EINTR) + continue; + else + break; + } r += n; } return r; --- import/clone.c.orig Sun Feb 9 19:04:36 2003 +++ import/clone.c Sun Feb 9 19:04:34 2003 @@ -75,6 +75,8 @@ return(-1); } + fcntl(sfd, F_SETFD, FD_CLOEXEC); + if(verbose & TC_DEBUG) fprintf(stderr, "(%s) reading video frame sync data from %s\n", __FILE__, logfile); // allocate space, assume max buffer size @@ -345,6 +347,7 @@ if((j=p_read(sfd, (char *) ptr->sync_info, sizeof(sync_info_t))) != sizeof(sync_info_t)) { + if(j < 0) perror("p_read failed"); if(verbose & TC_DEBUG) fprintf(stderr, "(%s) p_read error (%d/%d)\n", __FILE__, j, sizeof(sync_info_t)); pthread_mutex_lock(&buffer_fill_lock); clone_read_thread_flag=0; --- patch-pipe-io-new ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030209194701.S51046>