Skip to content

Infinite increase of memory during decoding hls-stream (memleak?) #25

@Yusupov28

Description

@Yusupov28

Hello. I tried to decode hls-stream and saw that memory increases infinitely by 264kb.

Could you explain why it happens?

For reproducing:

I ran Sample.cpp(made the infinite loop). Added this string for hls support after:
https://github.com/osai-ai/tensor-stream/blob/master/src/Parser.cpp#L309

av_dict_set(&opts, "protocol_whitelist", "file,udp,rtp,tcp,http,https,tls,crypto", 0); 

And I used python for recording new ts to playlist.

import os, time

if __name__ == "__main__":
    while True:
        #TODO change path
        playlist = "your_path/test_playlist.m3u8"

        with open(playlist, 'r') as hls_file:
            data = hls_file.readlines()

        data.append("#EXTINF:4,\n")
        data.append("https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_9.ts\n")
		
        with open(playlist, 'w') as hls_file:
            hls_file.writelines(data)

        del data

        time.sleep(0.1)

Initial test_playlist.m3u8:

#EXTM3U

#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4

#EXTINF:4.0
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_0.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_1.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_2.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_3.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_4.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_5.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_6.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_7.ts
#EXTINF:4.
https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_8.ts

And I also tried not to call getFrame from WrapperPython.ccp(I ran tensor-stream from python), processingLoop was working and the memory also increased.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions