[FFmpeg-devel] [FFmpeg-cvslog] dnn/queue: add queue and safe_queue support
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Wed Dec 30 01:36:33 EET 2020
Michael Niedermayer:
> On Tue, Dec 29, 2020 at 05:42:46AM +0000, Xie, Lin wrote:
>> ffmpeg | branch: master | Xie, Lin <lin.xie at intel.com> | Mon Nov 9 14:09:13 2020 +0800| [6506ab8b03dd6747f6ad6b836a347a6fc346708b] | committer: Guo, Yejun
>>
>> dnn/queue: add queue and safe_queue support
>>
>> Signed-off-by: Xie, Lin <lin.xie at intel.com>
>> Signed-off-by: Wu Zhiwen <zhiwen.wu at intel.com>
>> Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6506ab8b03dd6747f6ad6b836a347a6fc346708b
>> ---
>>
>> libavfilter/dnn/Makefile | 2 +
>> libavfilter/dnn/queue.c | 176 +++++++++++++++++++++++++++++++++++++++++++
>> libavfilter/dnn/queue.h | 41 ++++++++++
>> libavfilter/dnn/safe_queue.c | 92 ++++++++++++++++++++++
>> libavfilter/dnn/safe_queue.h | 36 +++++++++
>> 5 files changed, 347 insertions(+)
>
> breaks build with --disable-pthreads
>
> src/libavfilter/dnn/safe_queue.c: In function ‘safe_queue_create’:
> src/libavfilter/dnn/safe_queue.c:44:5: error: implicit declaration of function ‘pthread_mutex_init’; did you mean ‘ff_mutex_init’? [-Werror=implicit-function-declaration]
> pthread_mutex_init(&sq->mutex, NULL);
> ^~~~~~~~~~~~~~~~~~
> ff_mutex_init
> src/libavfilter/dnn/safe_queue.c:45:5: error: implicit declaration of function ‘pthread_cond_init’ [-Werror=implicit-function-declaration]
> pthread_cond_init(&sq->cond, NULL);
> ^~~~~~~~~~~~~~~~~
> src/libavfilter/dnn/safe_queue.c: In function ‘safe_queue_destroy’:
> src/libavfilter/dnn/safe_queue.c:55:5: error: implicit declaration of function ‘pthread_mutex_destroy’; did you mean ‘ff_mutex_destroy’? [-Werror=implicit-function-declaration]
> pthread_mutex_destroy(&sq->mutex);
> ^~~~~~~~~~~~~~~~~~~~~
> ff_mutex_destroy
> src/libavfilter/dnn/safe_queue.c:56:5: error: implicit declaration of function ‘pthread_cond_destroy’; did you mean ‘__NR_io_destroy’? [-Werror=implicit-function-declaration]
> pthread_cond_destroy(&sq->cond);
> ^~~~~~~~~~~~~~~~~~~~
> __NR_io_destroy
> src/libavfilter/dnn/safe_queue.c: In function ‘safe_queue_push_front’:
> src/libavfilter/dnn/safe_queue.c:67:5: error: implicit declaration of function ‘pthread_mutex_lock’; did you mean ‘ff_mutex_lock’? [-Werror=implicit-function-declaration]
> pthread_mutex_lock(&sq->mutex);
> ^~~~~~~~~~~~~~~~~~
> ff_mutex_lock
> src/libavfilter/dnn/safe_queue.c:69:5: error: implicit declaration of function ‘pthread_cond_signal’ [-Werror=implicit-function-declaration]
> pthread_cond_signal(&sq->cond);
> ^~~~~~~~~~~~~~~~~~~
> src/libavfilter/dnn/safe_queue.c:70:5: error: implicit declaration of function ‘pthread_mutex_unlock’; did you mean ‘ff_mutex_unlock’? [-Werror=implicit-function-declaration]
> pthread_mutex_unlock(&sq->mutex);
> ^~~~~~~~~~~~~~~~~~~~
> ff_mutex_unlock
> src/libavfilter/dnn/safe_queue.c: In function ‘safe_queue_pop_front’:
> src/libavfilter/dnn/safe_queue.c:86:9: error: implicit declaration of function ‘pthread_cond_wait’; did you mean ‘__pread_chk_warn’? [-Werror=implicit-function-declaration]
> pthread_cond_wait(&sq->cond, &sq->mutex);
> ^~~~~~~~~~~~~~~~~
> __pread_chk_warn
> cc1: some warnings being treated as errors
> src/ffbuild/common.mak:67: recipe for target 'libavfilter/dnn/safe_queue.o' failed
> make: *** [libavfilter/dnn/safe_queue.o] Error 1
>
>
It also breaks building with compilers that don't support C11
(redefining typedefs is a C11 feature, before that the one definition
rule applied:
http://fate.ffmpeg.org/log.cgi?slot=x86_32-debian-kfreebsd-gcc-4.4&log=compile&time=20201227203843)
and it also does not abide by the our naming conventions: No ff prefix,
no CamelCase for types. And worst of it all, there is no error checking
and no cleanup at all. create_entry in queue.c even asserts that an
allocation succeeds. And the whole API is wrong as it is built on the
assumption that allocations succeed (in reality queue_push_back/front
can fail).
This needs to be fixed or reverted (some commits already depend on it).
- Andreas
More information about the ffmpeg-devel
mailing list