Audio/video stream recording forums
|
Attention Visitor: |
You may have to register or log in before you can post:
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
rtmpgw is spiking the processor when run in background - solvedHi everyone. I don't know how many people have seen this problem, but I figured out a solution so I thought I would share it.
Problem: when invoking rtmpgw from the shell with nohup to detach it from the shell and let it run as a daemon in the background, the process would jump to 100% cpu even though it was just sitting there waiting for further commands. nohup rtmpgw -g 8902 > rtmplog.txt 2>&1 & exit The log that nohup produced after just a few seconds was tens of thousands of lines of repeating text like this: HTTP-RTMP Stream Gateway v2.4 (c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL Streaming on http://0.0.0.0:8902 Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring Unknown command '<FF>', ignoring I tracked this down to a bug in the source code that gets confused when stdin is closed, and reacts as if the computer is continually typing the EOF character, generating the above error message. This can be worked around by deleting most of the code in the area where keyboard input is processed. The only thing this part of the code does is listen for the letter 'q', to quit the server. It returns an error for anything else. Since it is just as easy to hit Ctrl-C as it is to hit q to quit the server, this code is really unnecessary. It starts on line 272 of rtmpgw.c controlServerThread(void *unused) { /* char ich; while (1) { ich = getchar(); switch (ich) { case 'q': RTMP_LogPrintf("Exiting\n"); stopStreaming(httpServer); exit(0); break; default: //RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich); break; } } */ TFRET(); } I simply inserted C-language comment codes to comment out the whole code block. Then recompile, and everything works as expected. If any of the devs see this, they may want to consider adding a command line switch to shut this part of the code down when you want to run rtmpgw as a detached background process or daemon. Hope this helps. -jerimiah797 Last edited by jerimiah797 : 02-20-2013 at 11:54 AM. Reason: fix typos |
#2
|
|||
|
|||
Re: rtmpgw is spiking the processor when run in background - solvedThank you for good information.
I have to see the same problem. Dreambox 800HD consume 90% of CPU and hang.I try to find to solve this problem and found this forum.But I can't compile rtmpgw.c for dreambox 800HD. Can you suggest me to compile rtmpgw.c for dreambox? Thank a lot |
#3
|
|||
|
|||
Re: rtmpgw is spiking the processor when run in background - solvedWow! Thanks for posting this. You saved me some time figuring it out.
If anyone else comes across this, I've forked rmtpdump and implemented the commenting mentioned here at: https://github.com/krisf/rtmpdump I also added a sample init script that works on RHEL/CentOS for use with rtmpsuck |
#4
|
|||
|
|||
Re: rtmpgw is spiking the processor when run in background - solvedAwesome, thanks for the github link.
-jerimiah |
Tags: daemon, rtmpgw |
Thread Tools | |
Display Modes | |
|
|