ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to display, need to restore with stty echo

winlinvip opened this issue · comments

Description'

Please ensure that the markdown structure is maintained.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

  1. SRS version: 3.0.114

Replay

How to replay bug?

Steps to reproduce the bug

  1. ./objs/srs -c conf/ingest.conf
    Steps to reproduce the bug:

  2. Press CTRL+C to cancel.

  3. There may be no feedback, so you need to run stty echo to restore it.

Note: It is easier to reproduce when there are multiple Ingesters.

Expected behavior (Expect)

> Describe your expectation (Please describe your expectation)

Terminal echo is normal.

TRANS_BY_GPT3

Change to print logs without color, directly use printf(log_str), the same issue will occur.
Enabling 3 Ingests almost always triggers it, it can also be reproduced by using killall srs.

TRANS_BY_GPT3

It seems that after starting the FFMPEG process, STDIN was not closed, redirecting STDIN to /dev/null will fix it.

TRANS_BY_GPT3

There is no direct closing of stdin, but instead dup2(/dev/null, stdin) is used to keep stdin file descriptor existing. There was a comment mentioning that closing stdin would cause FFMPEG to fail. Although it did not fail when tested, there might be some risks, so the dup2 method was adopted.

TRANS_BY_GPT3