Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Kernel: Fix demux SPS error for NVENC and LARIX. v6.0.22 #3389

Merged

Conversation

chundonglinlin
Copy link
Member

When publish stream with NVENC and LARIX by SRT or RTMP, maybe demux pps failed. Likely,

[2023-01-27 15:14:46.881][WARN][2338][81rhc7z9][22] parse ts packet err=code=4054(CasterTsHevcVps)(Invalid ts HEVC VPS for stream caster) : ts: handle ts message : ts: consume hevc video : check vps sps pps : srt to rtmp vps/sps/pps : format consume video : demux hevc VPS/SPS/PPS : hevc demux vps/sps/pps failed : scaling_list_delta_coef : read uev : no bytes for leadingZeroBits=1
thread [2338][81rhc7z9]: decode() [./src/kernel/srs_kernel_ts.cpp:273][errno=22]
thread [2338][81rhc7z9]: on_ts_message() [./src/app/srs_app_srt_source.cpp:364][errno=22]
thread [2338][81rhc7z9]: on_ts_video_hevc() [./src/app/srs_app_srt_source.cpp:607][errno=22]
thread [2338][81rhc7z9]: check_vps_sps_pps_change() [./src/app/srs_app_srt_source.cpp:654][errno=22]
thread [2338][81rhc7z9]: on_video_imp() [./src/app/srs_app_source.cpp:2437][errno=22]
thread [2338][81rhc7z9]: video_avc_demux() [./src/kernel/srs_kernel_codec.cpp:896][errno=22]
thread [2338][81rhc7z9]: hevc_demux_hvcc() [./src/kernel/srs_kernel_codec.cpp:1050][errno=22]
thread [2338][81rhc7z9]: hevc_demux_pps_rbsp() [./src/kernel/srs_kernel_codec.cpp:1698][errno=22]
thread [2338][81rhc7z9]: read_bits_se() [./src/kernel/srs_kernel_buffer.cpp:511][errno=22]
thread [2338][81rhc7z9]: read_bits_ue() [./src/kernel/srs_kernel_buffer.cpp:489][errno=22]
[2023-01-27 15:14:46.881][WARN][2338][81rhc7z9][22] parse ts packet err=code=4019(CasterTsPse)(Invalid ts PSE payload for stream caster) : ts: ts packet decode : ts: demux payload : ts: PES fresh packet length=0, us=0, cc=5
thread [2338][81rhc7z9]: decode() [./src/kernel/srs_kernel_ts.cpp:264][errno=22]
thread [2338][81rhc7z9]: decode() [./src/kernel/srs_kernel_ts.cpp:629][errno=22]
thread [2338][81rhc7z9]: decode() [./src/kernel/srs_kernel_ts.cpp:1955][errno=22]

@johan149
Copy link

it's not working yet. When I stream using NVENC, I get this:

[2023-01-27 15:53:26.736][INFO][1][379m06q7] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0
[2023-01-27 15:53:26.736][INFO][1][028s0412] TCP: disposing #0 resource(HttpConn)(0x7ff4dc0aae30), conns=2, disposing=1, zombies=0
[2023-01-27 15:53:27.523][ERROR][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/common.cpp:305(pton) # : pton: IPE or net error: can't determine IPv4 carryover format: 6400:9bff:0:0:0:0:7432:532c(Resource temporarily unavailable)
[2023-01-27 15:53:27.523][WARN][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/core.cpp:2156(processSrtMsg_HSREQ) # : HSREQ/rcv: Agent did not set rcv-TSBPD - ignoring proposed latency from peer
[2023-01-27 15:53:27.523][ERROR][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/common.cpp:305(pton) # : pton: IPE or net error: can't determine IPv4 carryover format: 6400:9bff:0:0:0:0:7432:532c(Resource temporarily unavailable)
[2023-01-27 15:53:27.531][ERROR][1][6a823h29][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/api.cpp:1116(accept) # : srt_accept: no pending connection available at the moment(Resource temporarily unavailable)

and when I tried to play the .ts stream, I get this

[2023-01-27 15:53:44.491][INFO][1][bi42mu17] TCP: before dispose resource(HttpConn)(0x7ff4dc2aa750), conns=2, zombies=0, ign=0, inz=0, ind=0
[2023-01-27 15:53:44.491][ERROR][1][bi42mu17][0] serve error code=4054(CasterTsHevcVps)(Invalid ts HEVC VPS for stream caster) : process request=0 : mux serve : serve http : send messages : send messages : write video : ts: on video : demux hevc VPS/SPS/PPS : hevc demux vps/sps/pps failed : log2_sao_offset_scale_luma : no bytes for leadingZeroBits=1
thread [1][bi42mu17]: process_requests() [./src/app/srs_app_http_conn.cpp:206][errno=0]
thread [1][bi42mu17]: process_request() [./src/app/srs_app_http_conn.cpp:233][errno=0]
thread [1][bi42mu17]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:765][errno=0]
thread [1][bi42mu17]: do_serve_http() [./src/app/srs_app_http_stream.cpp:758][errno=0]
thread [1][bi42mu17]: streaming_send_messages() [./src/app/srs_app_http_stream.cpp:858][errno=0]
thread [1][bi42mu17]: write_video() [./src/app/srs_app_http_stream.cpp:214][errno=0]
thread [1][bi42mu17]: write_video() [./src/kernel/srs_kernel_ts.cpp:3273][errno=0]
thread [1][bi42mu17]: video_avc_demux() [./src/kernel/srs_kernel_codec.cpp:896][errno=0]
thread [1][bi42mu17]: hevc_demux_hvcc() [./src/kernel/srs_kernel_codec.cpp:1050][errno=0]
thread [1][bi42mu17]: hevc_demux_pps_rbsp() [./src/kernel/srs_kernel_codec.cpp:1788][errno=0]
thread [1][bi42mu17]: read_bits_ue() [./src/kernel/srs_kernel_buffer.cpp:489][errno=0]
[2023-01-27 15:53:44.491][INFO][1][379m06q7] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0

@chundonglinlin
Copy link
Member Author

chundonglinlin commented Jan 27, 2023

it's not working yet. When I stream using NVENC, I get this:

[2023-01-27 15:53:26.736][INFO][1][379m06q7] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0
[2023-01-27 15:53:26.736][INFO][1][028s0412] TCP: disposing #0 resource(HttpConn)(0x7ff4dc0aae30), conns=2, disposing=1, zombies=0
[2023-01-27 15:53:27.523][ERROR][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/common.cpp:305(pton) # : pton: IPE or net error: can't determine IPv4 carryover format: 6400:9bff:0:0:0:0:7432:532c(Resource temporarily unavailable)
[2023-01-27 15:53:27.523][WARN][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/core.cpp:2156(processSrtMsg_HSREQ) # : HSREQ/rcv: Agent did not set rcv-TSBPD - ignoring proposed latency from peer
[2023-01-27 15:53:27.523][ERROR][1][][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/common.cpp:305(pton) # : pton: IPE or net error: can't determine IPv4 carryover format: 6400:9bff:0:0:0:0:7432:532c(Resource temporarily unavailable)
[2023-01-27 15:53:27.531][ERROR][1][6a823h29][11][SRT] /srs/objs/Platform-SRS6-Linux-5.4.0-GCC4.8.5-x86_64/srt-1-fit/srtcore/api.cpp:1116(accept) # : srt_accept: no pending connection available at the moment(Resource temporarily unavailable)

and when I tried to play the .ts stream, I get this

[2023-01-27 15:53:44.491][INFO][1][bi42mu17] TCP: before dispose resource(HttpConn)(0x7ff4dc2aa750), conns=2, zombies=0, ign=0, inz=0, ind=0
[2023-01-27 15:53:44.491][ERROR][1][bi42mu17][0] serve error code=4054(CasterTsHevcVps)(Invalid ts HEVC VPS for stream caster) : process request=0 : mux serve : serve http : send messages : send messages : write video : ts: on video : demux hevc VPS/SPS/PPS : hevc demux vps/sps/pps failed : log2_sao_offset_scale_luma : no bytes for leadingZeroBits=1
thread [1][bi42mu17]: process_requests() [./src/app/srs_app_http_conn.cpp:206][errno=0]
thread [1][bi42mu17]: process_request() [./src/app/srs_app_http_conn.cpp:233][errno=0]
thread [1][bi42mu17]: serve_http() [./src/protocol/srs_protocol_http_stack.cpp:765][errno=0]
thread [1][bi42mu17]: do_serve_http() [./src/app/srs_app_http_stream.cpp:758][errno=0]
thread [1][bi42mu17]: streaming_send_messages() [./src/app/srs_app_http_stream.cpp:858][errno=0]
thread [1][bi42mu17]: write_video() [./src/app/srs_app_http_stream.cpp:214][errno=0]
thread [1][bi42mu17]: write_video() [./src/kernel/srs_kernel_ts.cpp:3273][errno=0]
thread [1][bi42mu17]: video_avc_demux() [./src/kernel/srs_kernel_codec.cpp:896][errno=0]
thread [1][bi42mu17]: hevc_demux_hvcc() [./src/kernel/srs_kernel_codec.cpp:1050][errno=0]
thread [1][bi42mu17]: hevc_demux_pps_rbsp() [./src/kernel/srs_kernel_codec.cpp:1788][errno=0]
thread [1][bi42mu17]: read_bits_ue() [./src/kernel/srs_kernel_buffer.cpp:489][errno=0]
[2023-01-27 15:53:44.491][INFO][1][379m06q7] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0

Do you successfully publish stream through LARIX APP? But you failed to play the .ts stream, url looks like http://127.0.0.1:8080/live/srt_hevc_nvenc.ts? @johan149

@johan149
Copy link

Yes, I was able to see the stream details on the webUI of SRS it was not showing blank anymore, but when I tried to play the srt_hevc_nvenc.ts didn't work.

@chundonglinlin
Copy link
Member Author

@johan149 Have you played other stream url, for instance,
srt_url: 'srt://127.0.0.1:10080?streamid=#!::r=live/srt_hevc_nvenc,m=request'
rtmp_url: rtmp://127.0.0.1:1935/live/srt_hevc_nvenc
http_flv_url: http://127.0.0.1:8080/live/srt_hevc_nvenc.flv
I see your SRS config again, I think you should play hls_url(http://127.0.0.1:8080/live/srt_hevc_nvenc.m3u8). If you want play http://127.0.0.1:8080/live/srt_hevc_nvenc.ts, you should add the following config,

    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].ts;
    }

@winlinvip
Copy link
Member

@johan149 Have you played other stream url, for instance, srt_url: 'srt://127.0.0.1:10080?streamid=#!::r=live/srt_hevc_nvenc,m=request' rtmp_url: rtmp://127.0.0.1:1935/live/srt_hevc_nvenc http_flv_url: http://127.0.0.1:8080/live/srt_hevc_nvenc.flv I see your SRS config again, I think you should play hls_url(http://127.0.0.1:8080/live/srt_hevc_nvenc.m3u8). If you want play http://127.0.0.1:8080/live/srt_hevc_nvenc.ts, you should add the following config,

    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].ts;
    }

If enable HLS and HTTP-TS, SRS can't identify the protocol(HLS or HTTP-TS) when viewer accesses the url http://x/y/z.ts, because it might be HTTP-TS or HLS file.

So, we should detect the conflict for HLS and HTTP-TS, which should return error when enable both.

Let me file another issue for this #3391

@johan149
Copy link

Oh yes, I had HLS, and TS turned ON. Let me try now with just SRT, FLV, HLS

@johan149
Copy link

johan149 commented Jan 28, 2023

@chundonglinlin @winlinvip, here are the results of the test I conducted.

Publish

srt://127.0.0.1:10080?streamid=#!::r=live/srt_hevc,m=publish

WORKS---------------FFmpeg libx265
WORKS---------------FFmpeg Nvenc
DOESN'T WORK------Larix Hevc
DOESN'T WORK------OBS Nvenc

Publish

rtmp://127.0.0.1:1935/live/rtmp_hevc

WORKS--------------FFmpeg libx265
WORKS--------------FFmpeg Nvenc
DOESN'T WORK-----Larix Hevc
DOESN'T WORK-----OBS Nvenc

Play

http://127.0.0.1:8080/live/srt_hevc.flv
rtmp://127.0.0.1:1935/live/srt_hevc
http://127.0.0.1:8080/live/srt_hevc.m3u8
srt://127.0.0.1:10080?streamid=#!::r=live/srt_hevc,m=request
http://127.0.0.1:8080/live/srt_hevc.ts

WORKS--------------FLV
WORKS--------------RTMP
WORKS--------------HLS
WORKS--------------SRT
DOESN'T WORK-----TS ----when HLS and TS are enabled.

@chundonglinlin
Copy link
Member Author

chundonglinlin commented Jan 30, 2023

@johan149

Do you test my branch(chundonglinlin:bugfix/fix-demux-codec-pps-error) by Larix APP publishing?

Moreover, DOESN'T WORK------OBS Nvenc how via obs hevc to test?

Do you have OBS-hevc plugin for test? You can provide me for test.

@johan149
Copy link

@johan149

Do you test my branch(chundonglinlin:bugfix/fix-demux-codec-pps-error) by Larix APP publishing?

Moreover, DOESN'T WORK------OBS Nvenc how via obs hevc to test?

Do you have OBS-hevc plugin for test? You can provide me for test.

Yes, I'm using your branch, and I get this error while trying to stream with Larix

image

and when I tried to stream with OBS-HEVC I get this error

image

I gave you access to a server with nvenc and obs support so we can test. check discord.

sub_layer_profile_space.clear();
sub_layer_tier_flag.clear();
sub_layer_profile_idc.clear();
sub_layer_profile_compatibility_flag.clear();
Copy link
Member

@winlinvip winlinvip Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When released, these vectors don't need to be taken care of, right? They will be released automatically.

TRANS_BY_GPT3

sub_layer_level_idc.clear();
}

srs_error_t SrsHevcProfileTierLevel::dumps(SrsHevcProfileTierLevel* ptl)
Copy link
Member

@winlinvip winlinvip Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do a direct value copy?

*this = *ptl

Or maybe we don't need to use dumps, just do a direct assignment.

sps->ptl.dumps(&profile_tier_level);

Change it to...

sps->ptl = profile_tier_level;

TRANS_BY_GPT3

@winlinvip winlinvip changed the title Kernel: demux stream pps error for NVENC and LARIX.(#3388) Kernel: Fix demux VPS error for NVENC and LARIX.(#3388) Feb 7, 2023
@winlinvip winlinvip changed the title Kernel: Fix demux VPS error for NVENC and LARIX.(#3388) Kernel: Fix demux SPS error for NVENC and LARIX.(#3388) Feb 7, 2023
@winlinvip winlinvip linked an issue Feb 8, 2023 that may be closed by this pull request
@winlinvip winlinvip changed the title Kernel: Fix demux SPS error for NVENC and LARIX.(#3388) Kernel: Fix demux SPS error for NVENC and LARIX. v6.0.22 (#3389) Feb 8, 2023
@winlinvip winlinvip changed the title Kernel: Fix demux SPS error for NVENC and LARIX. v6.0.22 (#3389) Kernel: Fix demux SPS error for NVENC and LARIX. v6.0.22 Feb 8, 2023
@winlinvip winlinvip added this to the 6.0 milestone Feb 8, 2023
@winlinvip winlinvip merged commit 2b0e32a into ossrs:develop Feb 8, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

H265: Support HEVC over SRT, RTMP with NVENC and LARIX
4 participants