[Libav-user] How to clear real-time buffer?

Roger Pack rogerdpack2 at gmail.com
Fri Mar 27 06:08:27 EET 2020


You'd probably have to drill into dshow.c and maybe add a method to it?

On Thu, Nov 29, 2018 at 6:16 AM DDD ZZZ <mymail67-at-mail.ru at ffmpeg.org> wrote:
>
> Hi everybody!
> Here's the part of c++ code that I'm using to access my webcam.
>
> **********************************************************************
> **********************************************************************
>
> int Camera::Init(char* file_name,
>                 char* device_name,
>                 char* format,
>                 char* resolution,
>                 char* frame_rate,
>                 char* pixel_format)
> {
>     av_log(NULL, AV_LOG_INFO, "---INIT STARTED---\n");
>     avdevice_register_all();
>     av_register_all();
>
>     AVDictionary* properties_collection = NULL;
>     av_dict_set(&properties_collection, "f", format, NULL);
>     av_dict_set(&properties_collection, "video_size", resolution, NULL);
>     av_dict_set(&properties_collection, "framerate", frame_rate, NULL);
>     av_dict_set(&properties_collection, "pix_fmt", pixel_format, NULL);
>     AVInputFormat *input_format = av_find_input_format("dshow");
>     char command_line[256];
>     sprintf(command_line, "video=%s", device_name);
>     AVFormatContext *input_context = avformat_alloc_context();
>     //input_context->flags |= AVFMT_FLAG_NOBUFFER;      //DOESN'T HELP
>     //input_context->max_picture_buffer = 0;            //ERR
>
>     int err_code = 0;
>     err_code = avformat_open_input(&input_context,
>                                     command_line,
>                                     input_format,
>                                     &properties_collection);
>
> //////////////////////////////////////
> //////////PROBLEM SECTION/////////////
> //////////////////////////////////////
>     int i = 0;
>     while (i++ < 30)
>     {
>         Sleep(1000);
>         //avformat_flush(input_context); //DOESN'T HELP
>         //av_free(input_context); //ERR
>     }
> //////////////////////////////////////
>     system("pause");
>     return 0;
> }
>
> **********************************************************************
> **********************************************************************
>
> Right after "avformat_open_input()" it starts reading frames to some internal buffer without me even calling "av_read_frame()". After about 10 seconds it start's giving me error messages:
>
> [dshow @ 0014ed40] real-time buffer [VirtualBox Webcam - FULL HD 1080P Webcam] [video input]
> too full or near too full (62% of size: 3041280 [rtbufsize parameter])!
> frame dropped!
> ...
> ...
> ...
> [dshow @ 0014ed40] real-time buffer [VirtualBox Webcam - FULL HD 1080P Webcam] [video input]
> too full or near too full (100% of size: 3041280 [rtbufsize parameter])!
> frame dropped!
>
>
> Q: How to clear this buffer or avoid using it?
>
> Thanks in advance.
>
>
>
> P.S.Please pardon my english.
>
> P.P.S.Have a good day.
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".


More information about the Libav-user mailing list