AirenSoft / OvenMediaEngine

OvenMediaEngine (OME) is a Sub-Second Latency Live Streaming Server with Large-Scale and High-Definition. #WebRTC #LLHLS
https://airensoft.com/ome.html
GNU Affero General Public License v3.0
2.57k stars 1.06k forks source link

LLHLS 401 when using AdmissionWebhooks #1035

Closed un-hongly closed 1 year ago

un-hongly commented 1 year ago

I can't view a LLHLS stream when AdmissionWebhooks enabled. the log say "invalid session_key".

Here my docker log:

[2023-02-22 06:58:06.982] I [SPRtcSig-T3333:16] AccessController | access_controller.cpp:183  | AdmissionWebhooks queried http://192.168.160.118:3000/admissions whether client 172.17.0.1:45806 could access http://127.0.0.1:3333/app/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsInN0cmVhbUlkIjoiNjNmNWJjMWU1YTcyMWJhMmIyMGY4ODdjIiwidHlwZSI6InZpZXciLCJpYXQiOjE2NzcwNDg4NjJ9.x269Grd4nYGMlzctsDusSvNtu4McaluNF2OKKsn1jto/llhls.m3u8. (Result : Allow Elapsed : 4 ms)
[2023-02-22 06:58:06.982] I [StreamWorker:62] Monitor | stream_metrics.cpp:114  | A new session has started playing #default#app/63f5bc1e5a721ba2b20f887c on the LLHLS publisher. LLHLS(1)/Stream total(2)/App total(2)
[2023-02-22 06:58:06.987] E [SPRtcSig-T3333:16] LLHLS Publisher | llhls_publisher.cpp:405  | Invalid session_key : http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_0_video_WcyHJePn_llhls.m3u8
[2023-02-22 06:58:06.987] E [SPRtcSig-T3333:16] HttpServer | http_exchange.cpp:43   | 
[Client] HttpConnection(0xffffb7c1f810) : HTTP/1.1 <ClientSocket: 0xffffb7c62e10, #39, Connected, TCP, Nonblocking, 172.17.0.1:45808> TLS(Disabled) [Duration] 0 
[Request] URL(http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_0_video_WcyHJePn_llhls.m3u8) Method(GET) Version(1.1) Request Time(2023-02-22T06:58:06.987+00:00)
[Response] Status(401) Sent Size(0) Response Time(2023-02-22T06:58:06.987+00:00)

[2023-02-22 06:58:06.988] E [SPRtcSig-T3333:16] LLHLS Publisher | llhls_publisher.cpp:405  | Invalid session_key : http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_1_audio_WcyHJePn_llhls.m3u8
[2023-02-22 06:58:06.988] E [SPRtcSig-T3333:16] HttpServer | http_exchange.cpp:43   | 
[Client] HttpConnection(0xffffb7c1f810) : HTTP/1.1 <ClientSocket: 0xffffb7c62e10, #39, Connected, TCP, Nonblocking, 172.17.0.1:45808> TLS(Disabled) [Duration] 0 
[Request] URL(http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_1_audio_WcyHJePn_llhls.m3u8) Method(GET) Version(1.1) Request Time(2023-02-22T06:58:06.988+00:00)
[Response] Status(401) Sent Size(0) Response Time(2023-02-22T06:58:06.988+00:00)

[2023-02-22 06:58:06.988] I [SPRtcSig-T3333:16] Monitor | stream_metrics.cpp:163  | 1 sessions has been stopped playing #default#app/63f5bc1e5a721ba2b20f887c on the LLHLS publisher. Concurrent Viewers[LLHLS(0)/Stream total(1)/App total(1)]
[2023-02-22 06:58:57.278] E [SPRtcSig-T3333:16] LLHLS Publisher | llhls_publisher.cpp:405  | Invalid session_key : http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_1_audio_WcyHJePn_llhls.m3u8
[2023-02-22 06:58:57.278] E [SPRtcSig-T3333:16] HttpServer | http_exchange.cpp:43   | 
[Client] HttpConnection(0xffffb7c00010) : HTTP/1.1 <ClientSocket: 0xffffb7c1f210, #38, Connected, TCP, Nonblocking, 172.17.0.1:45884> TLS(Disabled) [Duration] 0 
[Request] URL(http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_1_audio_WcyHJePn_llhls.m3u8) Method(GET) Version(1.1) Request Time(2023-02-22T06:58:57.278+00:00)
[Response] Status(401) Sent Size(0) Response Time(2023-02-22T06:58:57.278+00:00)
umeshshende commented 1 year ago

Post your return response of API http://192.168.160.118:3000/admissions Are you able to play with this url http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_0_video_WcyHJePn_llhls.m3u8 (WITHOUT WEBHOOK)?

un-hongly commented 1 year ago

Post your return response of API http://192.168.160.118:3000/admissions

My response is :

{
  allowed: true,
  new_url: 'http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/llhls.m3u8',
  reason: 'authorized'
}

Are you able to play with this url http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/chunklist_0_video_WcyHJePn_llhls.m3u8 (WITHOUT WEBHOOK)?

What does it mean "without webhook"? I tried this url with VLC player but it can't be opened.

un-hongly commented 1 year ago

More information I ran it as docker with latest tag.

It work well with WebRTC with response below. { allowed: true, new_url: 'ws://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c', reason: 'authorized' }

getroot commented 1 year ago

I tried several times but couldn't reproduce this issue.

Please upload your entire /var/log/ovenmediaengine/ovenmediaengine.log file and Server.xml file.

It looks like your llhls.m3u8 file is missing ?session information. If <OriginMode> is false then ?session cannot be missing, but in your case something is misbehaving.

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Audio_4061823101",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2",URI="/app/stream/chunklist_1_audio_s4DmxfON_llhls.m3u8 ?session=27_b3EjTov7"

#EXT-X-STREAM-INF:BANDWIDTH=2916481,RESOLUTION=1280x720,FRAME-RATE=30.769,CODECS="avc1.42c01f,mp4a.40.2",AUDIO="aac"
/app/stream/chunklist_4_video_s4DmxfON_llhls.m3u8?session=27_b3EjTov7

What about the content of your below file? Please upload it.

http://127.0.0.1:3333/app/63f5bc1e5a721ba2b20f887c/llhls.m3u8

un-hongly commented 1 year ago

@getroot

please find all the file here (new stream not the one before) files.zip

my post response is:

{
  allowed: true,
  new_url: 'http://192.168.160.123:3333/app/63f714dedc3f3d800e24862b/llhls.m3u8',
  reason: 'authorized'
}
getroot commented 1 year ago

Change <Publishers><LLHLS><OriginMode>true</OriginMode> to false. AdmissionWebhooks are not available in OriginMode.

un-hongly commented 1 year ago

@getroot Work like magic!! Thanks 😊

getroot commented 1 year ago

Great, please close this issue.