Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
20th December 2007, 04:35 | #1 | Link |
Registered User
Join Date: Jan 2002
Posts: 267
|
Possible bug in soundout()?
I think I've encountered what I consider a bug in soundout(), that causes a race condition in AutoMKV on my quad core box.
Namely, soundout() doesn't close stdout to a "cmd" output type until it actually closes (i.e. if one has a std 5sec timeout, it doesn't close it until the timeout expires or one hits "close"). Now, virtualdub exits right away, but the cmd process doesn't seem to have to exit right away. In AutoMKV, it sees that the virtualdub it spawned is closed and then looks at the file size to see if encoded correctly (has to be over a minimum size). Now, if the output program is NeroAAC, it seems to do a lot of housekeeping on the output file when it reaches the end of the input (i.e. its stdin reaches end of file due to soundout() closing stdout). Part of this housekeeping seems to be rewriting the file from scratch (or at least refreshing file size quickly shows the file size drop to 0 and then be recreated). On a quadcore box, automkv is able to get the size of the file when its 0. From my perspective, either soundout() should close stdout earlier, or more correctly, avisynth/virtualdub shouldn't exit until the programs they executed (in this case neroaac) exit. |
20th December 2007, 08:46 | #2 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
@spotter: Thanks, I'll investigate. I'm currently experimenting with various additions/rewrites, so I hope you have a little patience. Hopefully in the beginning of the new year.
__________________
Regards, sh0dan // VoxPod |
6th January 2008, 13:47 | #4 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
The output pipe is closed immediately after the last samples have been delivered.
The process is however forcefully terminated, when the windows is closed. Nero might not be finished updating the file when it is terminated. Is the output correct, if you do not use autoclose or close the window early?
__________________
Regards, sh0dan // VoxPod |
6th January 2008, 15:19 | #5 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Please try: http://klauspost.googlepages.com/SoundOut-test.zip
I have added a process exit check. It will wait 5 seconds. If more than 5 seconds elapses it will ask if you forcefully wants to terminate the thread.
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 6th January 2008 at 15:22. |
8th January 2008, 18:19 | #7 | Link |
Registered User
Join Date: Jan 2002
Posts: 267
|
it took longer than 5s to exit, but it did exit before I said ok to killing it. Any chance soundout can just wait till it exits by default, ala in unix
if (pid = fork()) { wait(pid); } else { exec(); } not a win32 programmer (even after spending a summer at microsoft), so unsure about the semantics for windows. Last edited by spotter; 8th January 2008 at 18:22. |
8th January 2008, 19:50 | #8 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Basicly I deliver all the audio samples, close the pipes and wait for the process to exit by itself.
Could you provide some additional info so I can reproduce the bug, since NeroAAC works fine here.
__________________
Regards, sh0dan // VoxPod |
8th January 2008, 20:10 | #9 | Link | |
Registered User
Join Date: Jan 2002
Posts: 267
|
this is the script automkv creates
Quote:
What I'm asking, instead of the modified version that asks to forcably kill the child process, you just wait on that process to exit. |
|
11th January 2008, 10:22 | #11 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
@spotter: No - actually the prompt just proves that the fix is working. I've increased the timeout, and added a parameter to control it. I've tested with a 2 hour stream, and it works nicely.
The prompt must come up, if the app doesn't terminate by itself, otherwise users can be stuck there. The prompt actually does the opposite of what it's advertising.
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 11th January 2008 at 10:25. |
16th January 2008, 21:10 | #14 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
http://klauspost.googlepages.com/SoundOut-test2.zip
Rather untested though. Exit timeout is 60 seconds - if you don't want the box, increase "exittimeout" parameter until it doesn't appear - parameter is in seconds.
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 16th January 2008 at 21:13. |
Thread Tools | Search this Thread |
Display Modes | |
|
|