[FFmpeg-trac] #4722(avcodec:new): avcodec_alloc_context3 returns NULL - without error

FFmpeg trac at avcodec.org
Tue Jul 14 16:47:02 CEST 2015


#4722: avcodec_alloc_context3 returns NULL - without error
-----------------------------------+-----------------------------------
             Reporter:  TheSHEEEP  |                    Owner:
                 Type:  defect     |                   Status:  new
             Priority:  normal     |                Component:  avcodec
              Version:  2.7        |               Resolution:
             Keywords:             |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
-----------------------------------+-----------------------------------

Comment (by TheSHEEEP):

 Replying to [comment:4 gjdfgh]:
 > This function fails only if memory allocation fails, and it allocates
 only little memory. codec=NULL should work too, and also only fails if a
 small memory allocation fails.
 >
 That's what I would guess, but memory allocation is not a problem, the
 program allocates lots of it before, after and likely even at the same
 time in other threads. No worries, though, FFmpeg usage is limited to one
 thread only.

 I found out a workaround, though I have to say I do not understand it.
 If I do not use
 {{{
  decodeCodecContext = avcodec_alloc_context3(decodeCodec);
 }}}
 and instead do the following
 {{{
  decodeCodecContext = stream->codec;
 }}}
 Everything works correctly.

 Maybe avcodec_find_decoder does something that forbids the allocation of a
 new codec context?
 If so, it should clearly be stated.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4722#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list