winlin

fix the ffmpeg kill bug, wait until ffmpeg quit.

@@ -448,8 +448,12 @@ void SrsFFMPEG::stop() @@ -448,8 +448,12 @@ void SrsFFMPEG::stop()
448 srs_warn("kill the encoder failed, ignored. pid=%d", pid); 448 srs_warn("kill the encoder failed, ignored. pid=%d", pid);
449 } 449 }
450 450
  451 + // wait for the ffmpeg to quit.
  452 + // ffmpeg will gracefully quit if signal is:
  453 + // 1) SIGHUP 2) SIGINT 3) SIGQUIT
  454 + // other signals, directly exit(123).
451 int status = 0; 455 int status = 0;
452 - if (waitpid(pid, &status, WNOHANG) < 0) { 456 + if (waitpid(pid, &status, 0) < 0) {
453 srs_warn("wait the encoder quit failed, ignored. pid=%d", pid); 457 srs_warn("wait the encoder quit failed, ignored. pid=%d", pid);
454 } 458 }
455 459