Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

srs2.0.263 caches whether the stream has audio and provides a default value of 44.1K sampling rate. #1687

Closed
tinywinfun opened this issue Apr 2, 2020 · 3 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@tinywinfun
Copy link

tinywinfun commented Apr 2, 2020

srs2.0.263 caches whether the stream has audio and provides a default value: Audio: aac, 44100 Hz, stereo

SRS version (Version): 2.0.263

SRS configuration (Config) is as follows:

listen              1935;
max_connections     1000;
daemon              on;
pid                 ./objs/srs.pid;
srs_log_tank        file;
srs_log_file        ./objs/srs.log;
http_api {
    enabled         on;
    listen          1985;
    crossdomain     on;
}

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
        hstrs       on;
    }
    http_hooks {
        enabled         off;
        on_publish      "http://127.0.0.1:8002/srs/api/check";
    }

    hls {
        enabled         on;
        hls_path        /home/srsdrv;
        hls_fragment    1;
        hls_td_ratio    1.5;
        hls_on_error    continue;
        hls_cleanup     on;
        hls_wait_keyframe       on;
        hls_window      3;
    }

    gop_cache       off;
    queue_length    10;
    min_latency     on;
    mr {
        enabled     off;
    }
    mw_latency      10;
    tcp_nodelay     on;
}

Replay

I conducted the following test:

  1. Executed ffmpeg to only stream video without audio, and on the other side, played it using ffplay, which worked fine.
ffmpeg -i rtmp://192.168.0.134/live/push -an -c:v copy -f flv rtmp://192.168.0.134/live/noaudio
ffplay rtmp://192.168.0.134/live/noaudio

The ffplay command line also only printed video information.
Stream #0:0: Video: h264
2. After the previous step is completed, I used ffmpeg to simultaneously push audio and video information to the same streaming address.
ffmpeg -i rtmp://192.168.0.134/live/push -c copy -f flv rtmp://192.168.0.134/live/noaudio
At this point, ffplay playback is also normal, and the correct audio and video information with a 48K sampling rate is obtained. So far, everything is correct.

    Stream #0:0: Video: h264 (High), yuv420p(progressive), 360x288 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
  1. When performing the first step again, only pushing the video without pushing the audio, the following issue is observed:
    ffplay takes a long time to start playing, and it prints incorrect audio information, with an audio info of 44.1K.
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 360x288 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp

Expected Behavior (Expect)
I expect that after ending the stream, SRS does not keep a record of whether there was any previous audio or video information.

TRANS_BY_GPT3

@moyidaren
Copy link

moyidaren commented Apr 4, 2020

void SrsSource::on_unpublish()
{

srs_info("clear cache/metadata when unpublish.");
srs_trace("cleanup when unpublish");
//add xgw
dispose();

}
Try

TRANS_BY_GPT3

@limjoe
Copy link

limjoe commented Apr 8, 2020

I also found this issue #1630 in version 3.0, and it was resolved in version 3.0.

TRANS_BY_GPT3

@neurax6
Copy link

neurax6 commented May 7, 2020

I resolve this moving me pid ,log and html folder into var modifying all ./objs path

@winlinvip winlinvip self-assigned this Sep 4, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 4, 2021
@winlinvip winlinvip changed the title srs2.0.263缓存了流是否有音频,并给与了默认值44.1K采样率 srs2.0.263 caches whether the stream has audio and provides a default value of 44.1K sampling rate. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

5 participants