Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I use process.start() in my webpage. I call java transcoder in the process arguments. It transcodes files' format from .gsm to .wav. But sometime it takes a little bit long (as I thought) because when I try to play the file it says Media player cannot play the file and shows always the same size 97KB which is not correct and cannot be same for all file also. But when I wait some time then everything works fine. How can I understand process completed or not?

million thanks for your response.

Lilly
Posted

You need to use WaitForExit to determine when the process exits. It will block until the process terminates.

For more info, see http://support.microsoft.com/kb/305369[^]
 
Share this answer
 
Comments
LillyM 26-Apr-11 7:51am    
Great, I will try now and let you know.

Thanks a lot.
Nish Nishant 26-Apr-11 7:53am    
No problem. You are welcome.
Sergey Alexandrovich Kryukov 26-Apr-11 14:20pm    
My 5. If you need to wait for completion, this is the only good solution. If you need a process to be ready for some operation, this is harder to do, will need IPC.
--SA
LillyM 27-Apr-11 4:27am    
I tried this solution and it seems working. Thanks a lot to all of you.
When the file is 97Kb it, this is only the file that is reported back. In reality the file could already be much bigger but because the file is still open (and written to) it isn't updated to the actual size. Also, doesn't really matter because the file simply isn't done yet.

It would be faster to run the conversion of .gsm files like a service that converts files from one directory to another for example. The process is then resident in memory and ready to go when requested. Now you start it when needed and could be that it is already started multiple times by other users or not at all. Both could affect performance because there could already a lot of processes running or the jvm needs to start up. As a single service it is already started and only a single instance is going at a time. Maybe you could add multiprocessor support and add some threads that do the conversion but you stay in control of how many active conversions are executed.

A simple way to check if the conversion is ready, is to give the file some other extension. Simply converting somefile.gsm to somefile.wav, you could name it somefile.busy when still processing and rename it when complete. This way you can easily check if the file is done.

Good luck!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900