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

Mapped mode + remote isn't working, what's wrong with the config? #1546

Open
leshik opened this issue Oct 21, 2024 · 4 comments
Open

Mapped mode + remote isn't working, what's wrong with the config? #1546

leshik opened this issue Oct 21, 2024 · 4 comments

Comments

@leshik
Copy link

leshik commented Oct 21, 2024

Video files are served by Minio at http://127.0.0.1:9000/media.
For the sake of this test, /json/mapped/hls/test.json returns static json:

vod_upstream_location /json;
vod_remote_upstream_location /media;

server {
    listen 80;
    server_name _;

    location /json/mapped/hls/test.json {
        default_type application/json;
        return 200 '{"sequences":[{"clips":[{"type":"source","path":"http://127.0.0.1:9000/media/IMG_8707.mp4"}]}]}';
    }

    location ~ /media/[^/]+/(.*) {
        internal;
        proxy_pass http://127.0.0.1:9000/media/$1;
    }

    location /hls/ {
        vod hls;
        vod_mode remote;

        include /etc/nginx/segments.conf;
        include /etc/nginx/cors.conf;
    }

    location /mapped/hls/ {
        vod hls;
        vod_mode mapped;

        include /etc/nginx/segments.conf;
        include /etc/nginx/cors.conf;
    }
}

Now, the simple remote mode works fine:

$ curl http://localhost/hls/IMG_8707.mp4/index.m3u8
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:2.000,
http://localhost/hls/IMG_8707.mp4/seg-1-v1-a1.ts
#EXTINF:2.000,
http://localhost/hls/IMG_8707.mp4/seg-2-v1-a1.ts
#EXTINF:2.000,
http://localhost/hls/IMG_8707.mp4/seg-3-v1-a1.ts
#EXTINF:4.000,
http://localhost/hls/IMG_8707.mp4/seg-4-v1-a1.ts
#EXTINF:10.000,
http://localhost/hls/IMG_8707.mp4/seg-5-v1-a1.ts
#EXTINF:10.000,
http://localhost/hls/IMG_8707.mp4/seg-6-v1-a1.ts
#EXTINF:10.000,
http://localhost/hls/IMG_8707.mp4/seg-7-v1-a1.ts
#EXTINF:8.885,
http://localhost/hls/IMG_8707.mp4/seg-8-v1-a1.ts
#EXT-X-ENDLIST

But the mapped mode isn't:

curl http://localhost/mapped/hls/test.json/index.m3u8 results in 503, error.log is:

2024/10/21 17:23:54 [warn] 7#7: *5 ngx_child_request_initial_wev_handler: upstream is null, client: 192.168.97.1, server: _, request: "GET /mapped/hls/test.json/index.m3u8 HTTP/1.1", subrequest: "/json/mapped/hls/test.json", host: "localhost"
2024/10/21 17:23:54 [error] 7#7: *5 ngx_http_vod_map_run_step: not enough room in buffer for null terminator, client: 192.168.97.1, server: _, request: "GET /mapped/hls/test.json/index.m3u8 HTTP/1.1", host: "localhost"

JSON file is there:

$ curl http://localhost/json/mapped/hls/test.json
{"sequences":[{"clips":[{"type":"source","path":"http://127.0.0.1:9000/media/IMG_8707.mp4"}]}]}

What's wrong?

@navarro967
Copy link

@leshik Looks like it may be related to this:
#1546

The vod_upstream_location must point to a location that uses an upstream.

@leshik
Copy link
Author

leshik commented Oct 25, 2024

@navarro967 thanks, changed that, but now another error, and it's trying to make some weird subrequest:

2024/10/25 15:33:37 [warn] 7#7: *1 ngx_child_request_initial_wev_handler: upstream is null, client: 192.168.97.1, server: _, request: "GET /mapped/hls/test.json/index.m3u8 HTTP/1.1", subrequest: "/mediahttp://127.0.0.1:9000/media/IMG_8707.mp4", host: "localhost"
2024/10/25 15:33:37 [error] 7#7: *1 ngx_child_request_wev_handler: unexpected, output buffer is null, client: 192.168.97.1, server: _, request: "GET /mapped/hls/test.json/index.m3u8 HTTP/1.1", host: "localhost"

@navarro967
Copy link

@leshik Could you show the current config and a response from the current json endpoint?

@leshik
Copy link
Author

leshik commented Oct 25, 2024

@navarro967

vod_upstream_location /json;
vod_remote_upstream_location /media;

server {
    listen 8080;
    server_name _;

    location /json/mapped/hls/test.json {
        proxy_pass http://localhost;
        proxy_redirect off;
    }

    location ~ /media/[^/]+/(.*) {
        internal;
        proxy_pass http://127.0.0.1:9000/media/$1;
    }

    location /hls/ {
        vod hls;
        vod_mode remote;

        include /etc/nginx/segments.conf;
        include /etc/nginx/cors.conf;
    }

    location /mapped/hls/ {
        vod hls;
        vod_mode mapped;

        include /etc/nginx/segments.conf;
        include /etc/nginx/cors.conf;
    }
}
$ curl http://localhost/json/mapped/hls/test.json
{"sequences":[{"clips":[{"type":"source","path":"http://127.0.0.1:9000/media/IMG_8707.mp4"}]}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants