#144(undetermined:new): ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s)
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) -------------------------------+----------------------- Reporter: alexandru_mg3 | Type: defect Status: new | Priority: critical Component: undetermined | Version: 0.7-rc1 Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | -------------------------------+----------------------- 1. I'm using ffmpeg 0.7c (your mt integrated version) taht I built with mingw32 2. I run an h264 stream (a TV Channel) with ffplay on Windows , a full HD one (1920x1080), from DREAMBOX the stream video-codec is : h264 - mpeg4 avc (part 10) (h264) 1920x1080 frame rate 50 the audio codec is: a52 audio (aca ac3) (a52) 7.1 (I confirm this information runing also the stream with vlc too) 3. Command line : ffplay <h264-stream-url> (I run also another HD TV Channel having the same memory leaks) 4. BUG DESCRIPTION: during the playing, the memory quickly increased with aprox. 1MB/s, till the whole windows memory is exhausted after around 10-15min 4. I put some debug trackings and comments in ffplay and compiling again, I saw that : a. - the used codec is CODEC_ID_H264 b. - the place where additional memory is allocated is after each call to: " len1 = avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt); " Note: the pkt is always well deallocated in ffplay code and the frame is deallocated only once at the of the loop in ffplay code, as usual) c. The memory leaks don't appear when playing non-hd channels (so when using other codecs) 4. Viewing how huge is the memory leaks are (1MB/s) Seems that the AVFrame is set to some internal pictures that are never de-allocated h264 decode_frame... *pict = *(AVFrame*)h->next_output_pic; But this is only a supposition, of course, could well be some other buffers... 5. Practically the h264 codec cannot be used in this case. and is the single way to play HD TV Channels due to the mt facility. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/144> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) ------------------------------+--------------------------- Reporter: alexandru_mg3 | Owner: Type: defect | Status: open Priority: normal | Component: undetermined Version: 0.7-rc1 | Resolution: Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------------+--------------------------- Changes (by cehoyos): * priority: critical => normal * status: new => open Comment: Since I cannot reproduce your problem with a random H264/AC3/MPEG-TS file: Is the memory usage only reproducible with ffplay or also with ffmpeg? (For example ffmpeg -i file -qscale 5 -acodec ac3 -ab 256k out.avi) Is it also reproducible with -an or -vn? Is it also reproducible with latest git master? Please add complete, uncut output of ffmpeg (if the problem is also reproducible with ffmpeg) or ffplay (if the problem is only reproducible with ffplay). (Afaik, ac-3 does not support more than six channels.) -- Ticket URL: <https://avcodec.org/trac/ffmpeg/ticket/144#comment:1> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) ------------------------------+--------------------------- Reporter: alexandru_mg3 | Owner: Type: defect | Status: open Priority: normal | Component: undetermined Version: 0.7-rc1 | Resolution: Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------------+--------------------------- Comment (by alexandru_mg3): Replying to [comment:1 cehoyos]:
Since I cannot reproduce your problem with a random H264/AC3/MPEG-TS file:
I found the BUG in ffplay: current video_thread function: ======================= CURRENT ffplay code ===================================== ret = get_video_frame(is, frame, &pts_int, &pkt); pos = pkt.pos; #endif if (ret < 0) goto the_end; if (!ret) continue; pts = pts_int*av_q2d(is->video_st->time_base); ret = output_picture(is, frame, pts, pos); #if !CONFIG_AVFILTER av_free_packet(&pkt); ==================================================================== new video_thread function: ======================= CORRECTED ffplay code ===================================== ret = get_video_frame(is, frame, &pts_int, &pkt); pos = pkt.pos; // alexandru_mg3 - BEGIN - NEW CODE av_free_packet(&pkt); // alexandru_mg3 - END #endif if (ret < 0) goto the_end; if (!ret) continue; pts = pts_int*av_q2d(is->video_st->time_base); ret = output_picture(is, frame, pts, pos); #if !CONFIG_AVFILTER /* alexandru_mg3 - BEGIN - REMOVED CODE av_free_packet(&pkt); alexandru_mg3 - END */ .... ==================================================================== NOTE: NEED TO FREE THE PACKET EVEN FOR WHEN WE HAVE ERROR OR NEED TO IGNORE THEM -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/144#comment:2> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) ------------------------------+--------------------------- Reporter: alexandru_mg3 | Owner: Type: defect | Status: open Priority: normal | Component: undetermined Version: 0.7-rc1 | Resolution: Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------------+--------------------------- Comment (by alexandru_mg3): I tested ffplay, with the above correction, and there are no memory leaks now...on HD streams. Please integrate this correction in ffplay. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/144#comment:3> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) ------------------------------+--------------------------- Reporter: alexandru_mg3 | Owner: Type: defect | Status: open Priority: normal | Component: undetermined Version: 0.7-rc1 | Resolution: Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------------+--------------------------- Comment (by cehoyos): Please add at least: Complete, uncut output of ffplay, information if the problem is reproducible with latest git HEAD and a unified diff for your patch (as produced for example by git diff ffplay.c). -- Ticket URL: <https://avcodec.org/trac/ffmpeg/ticket/144#comment:4> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) ------------------------------+--------------------------- Reporter: alexandru_mg3 | Owner: Type: defect | Status: closed Priority: normal | Component: undetermined Version: 0.7-rc1 | Resolution: fixed Keywords: h264 memory leaks | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------------+--------------------------- Changes (by michael): * status: open => closed * resolution: => fixed Comment: Thanks for the debuging. Changes integrated locally will push soon. -- Ticket URL: <https://avcodec.org/trac/ffmpeg/ticket/144#comment:5> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#144: ffmpeg 0.7c FFPLAY using CODEC_ID_H264 HUGE MEMORY LEAKS (1MB/s) -------------------------------------+------------------------------------- Reporter: | Owner: alexandru_mg3 | Status: closed Type: defect | Component: Priority: normal | undetermined Version: 0.7-rc1 | Resolution: fixed Keywords: h264 leak | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by cehoyos): * keywords: h264 memory leaks => h264 leak -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/144#comment:6> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg