Giter VIP home page Giter VIP logo

Comments (2)

adrhc avatar adrhc commented on September 13, 2024 1

I found the problem and solution at https://stackoverflow.com/questions/20792427/why-is-my-node-child-process-that-i-created-via-spawn-hanging.

Here's the copy of the solution:

As it turns out once the stderr buffer exceeds 24kb you must be reading from it or you not see any events for completion. Possible workarounds:

Set the stdio option on the spawn call.

spawn('git', ['push', 'origin', 'master'], {stdio: 'ignore'});
See Node ChildProcess doc for all of the possibilities - there are lots.
Add an on(data) handler.
var git = spawn('git', ['push', 'origin', 'master']);
...
git.stderr.on('data', function(data) {
// do something with it
});
Pipe it to stdout / stderr. This may be too verbose for your application but including it for completeness.
var git = spawn('git', ['push', 'origin', 'master']);
...
git.stderr.pipe(process.stderr);
git.stdout.pipe(process.stdout);

from h264-live-player.

adrhc avatar adrhc commented on September 13, 2024

If I put in _server.js -> new_client(socket) -> socket.on(...):

      if(action == "REQUESTSTREAM") {
        self.start_feed();
      }
	  
      if(action == "STOPSTREAM") {
		try {
			self.streamer.kill();
			self.readStream = undefined;
		} catch (er) {
			console.log("self.readStream ended");
		}
      }

where streamer is spawn('ffmpeg', args) from ffmpeg.js I obtain the killing of ffmpeg process when pressing Stop Video button; when pressing the Start Video button the ffmpeg process restarts (started by self.start_feed call) so everything works fine.

I tested this behavior with two very different cameras. So why from time to time (~ 4 minutes) the node's child_process (streamer from ffmpeg.js) stops getting data from ffmpeg process?

Again: with some other software the same time I'm getting data from the same camera.

from h264-live-player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.