Opened 9 years ago

Closed 9 years ago

#521 closed defect (invalid)

avio_open_dyn_buf()/avio_close_dyn_buf(), limit the memory usage

Reported by: mrdebug Owned by:
Priority: normal Component: undetermined
Version: 0.8.3 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


In my program the functions "avio_open_dyn_buf() / avio_close_dyn_buf()" work fine. On "avio_close_dyn_buf()" I can save the buffer in a file and the file can be played correctly.
In order to limit the memory usage, I have inserted in my code this:

DynBuffer? *d= (DynBuffer?*)pFormatCtx->pb->opaque;
QByteArray QBAByteIn((const char*)d->buffer, d->pos);
d->pos= d->size= 0;

that's executed many times before "avio_close_dyn_buf()" function.
This works only with codecs CODEC_ID_THEORA and
CODEC_ID_MPEG4 but not with codecs CODEC_ID_VP8 and CODEC_ID_H264.
Is this a bug or is not possible to extract something from the buffer before "avio_close_dyn_buf()"?

See the source code attached.

Attachments (1)

qthcamera.cpp (17.9 KB) - added by mrdebug 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by mrdebug

comment:1 Changed 9 years ago by mrdebug


comment:2 Changed 9 years ago by reimar

  • Resolution set to invalid
  • Status changed from new to closed

You selected the mp4/mov muxer. That one needs to seek backwards and update data later on after everything is written.
That obviously is not possible if you dropped all of the data in the dynbuf.
At the very least you have to set pFormatCtx->pb->seekable to 0, because your change means that it is not possible for the muxer to go back and modify data it has written out previously.
But that will then result in the mov muxer bailing out because it can't work with that.
You can get something similar by selecting the ism format instead. But while it is basically the same as mov/mp4 according to code comments QuickTime? can't handle it.

Note: See TracTickets for help on using tickets.