[FFmpeg-devel] WinRT API support patch

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Nov 21 09:06:52 CET 2014


On 20.11.2014, at 09:48, Jesse Jiang <jessejiang0214 at outlook.com> wrote:
> Hi Reimar,
> Because of Windows RT cannot use CryptographicBuffer or _beginthreadex API, so I try to use rand() instead of it, or we need to write own function instead of it. If we use WinRT api to instead of these apis, it will cause more bugs.

Microsoft says explicitly that you should use _beginthreadex, so if WinRT doesn't have it or a useable alternative you'll have to disable threading or risk random crashes:

A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and_endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multithreaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions.


(note, this does not even mention the potential memleaks issue. And I don't know what insanity made them support only the broken function on WinRT. Seems to be typical Microsoft: when designing something new, only keep the most broken parts of the old and add whatever breakage you can on top).

> Best regards,Jesse
>> From: Reimar.Doeffinger at gmx.de
>> Date: Thu, 20 Nov 2014 09:18:30 +0100
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: Re: [FFmpeg-devel] WinRT API support patch
>> 
>> On 20 November 2014 08:34:54 CET, Jesse Jiang <jessejiang0214 at outlook.com> wrote:
>>> Add WinRT API supports              
>> 
>> At least 2 fairly major issues:
>> 1) using rand() basically never is correct. Use the appropriate CryptographicBuffer function (yes, that means you need some C++ code unfortunately).
>> 2) CreateThread is not compatible with _beginthreadex, there is a good reason why we use this. Using the other without additional changes will cause memleaks or worse. I am not even sure it is at all possible to use CreateThread correctly for us.
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>                         
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list