summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
Commit message (Collapse)AuthorAge
* lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-27
| | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavc: AV-prefix all codec flagsVittorio Giovara2015-07-27
| | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavc: split slice and frame threading functions into separate filesAnton Khirnov2013-11-04
|
* pthread: drop avcodec_ prefixes from static functionsAnton Khirnov2013-11-04
|
* lavc: deprecate AVCodecContext.debug_mvAnton Khirnov2013-10-31
| | | | It has been unused since 37045e422903695e610cca6ecb753df643ab9380.
* pthread: Avoid spurious wakeupsBen Jackson2013-10-21
| | | | | | | | | | | | | | | pthread_wait_cond can wake up unexpectedly (Wikipedia: Spurious_wakeup). The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or allow the caller of avctx->execute to return before all jobs were complete. Test both cases to ensure the wakeup is real. Signed-off-by: Ben Jackson <ben@ben.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* pthread: Fix deadlock during thread initializationDerek Buitenhuis2013-10-13
| | | | | | | | | | Sometimes, if pthread_create() failed, then pthread_cond_wait() could accidentally be called in the worker threads after the uninit function had already called pthread_cond_broadcast(), leading to a deadlock. Don't call pthread_cond_wait() if c->done is set. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* Disable deprecation warnings for cases where a replacement is availableDiego Biurrun2013-08-02
|
* pthread: Rename thread_init to avoid symbol collisionSean McGovern2013-07-17
| | | | | | The AIX threads library exposes a function with the same name. Signed-off-by: Martin Storsjö <martin@martin.st>
* Move get_logical_cpus() from lavc/pthread to lavu/cpu.Anton Khirnov2013-05-24
| | | | | It will be useful in lavfi, and could conceivably be useful to the user applications as well.
* w32pthreads: move from lavc to compat/Anton Khirnov2013-05-24
| | | | It will be used in other places than lavc.
* pthread: reindentAnton Khirnov2013-05-17
|
* lavc/pthread: remove obsolete checksAnton Khirnov2013-05-17
| | | | | | Those were useful when avcodec_thread_init() was a public functions. It was deprecated and removed some time ago, so those checks are not needed anymore.
* threads: always call thread_finish_setup for intra codecsJanne Grunau2013-04-22
| | | | | | | Intra codecs do not need an update_thread_context() function and never call ff_thread_finish_setup(). They rely on ff_thread_get_buffer() calling it. So call it even if the get_buffer2 function pointer is avcodec_default_get_buffer2 and it has not been called before.
* hwaccel: fix use with frame based multithreadingJanne Grunau2013-03-26
| | | | | | | | | | | | Allows use of AVHWAccel based decoders with frame based multithreading. The decoders will be forced into an non-concurrent mode by delaying ff_thread_finish_setup() calls after decoding of the current frame is finished. This wastes memory by unnecessarily using multiple threads and thus copies of the decoder context but allows seamless switching between hardware accelerated and frame threaded software decoding when the hardware decoder does not support the stream.
* pthread: unref already decoded frames when flushing the decoderHendrik Leppkes2013-03-19
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* pthread: unref the decoded but not returned frames on close.Anton Khirnov2013-03-11
| | | | | Fixes memleaks when frame mt is used and the decoder is not flushed at the end.
* lavc decoders: work with refcounted frames.Anton Khirnov2013-03-08
|
* pthread: avoid copying input packets when possible.Anton Khirnov2013-03-08
|
* pthread: make ff_thread_release_buffer idempotent.Anton Khirnov2013-01-29
| | | | I.e. don't do anything on already released frames.
* lavc: add a wrapper for AVCodecContext.get_buffer().Anton Khirnov2012-12-04
| | | | It will be useful in the upcoming transition to refcounted AVFrames.
* pthread: make sure AVFrame.extended_data is set properly.Anton Khirnov2012-09-25
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* pthread: add const to AVCodec pointersMans Rullgard2012-08-18
| | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* Don't include common.h from avutil.hMartin Storsjö2012-08-15
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* Avoid C99 variable declarations within for statements.Diego Biurrun2012-06-14
| | | | | We generally do not declare variables within for statements and there are compilers that choke on such constructs.
* pthread: warn on high thread countsSean McGovern2012-05-07
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* avcodec: remove AVCodecContext.dsp_maskMans Rullgard2012-04-21
| | | | | | | | This removes all references to AVCodecContext.dsp_mask and marks it for eviction at the next version bump. It has been superseded by av_set_cpu_flag_mask() which, unlike this field, works everywhere. Signed-off-by: Mans Rullgard <mans@mansr.com>
* pthread: Fix crash due to fctx->delaying not being cleared.Dale Curtis2012-04-12
| | | | | | | | | | | Reproducible with test case and ffplay -threads 2. Stack trace: http://pastebin.com/PexZ4Uc0 Test case: http://commondatastorage.googleapis.com/dalecurtis-shared/crash.ogm Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: Immediately release all frames in ff_thread_flush()Alexander Strange2012-03-24
| | | | | | | | Before this, they were only added to the delayed release queue and not freed until later. This could lead to unnecessary memory use or buffer exhaustion. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* pthread: free progress if buffer allocation failed.Ronald S. Bultje2012-03-24
| | | | | | | Else we run out of progress variables after a few failed buffer allocations. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/avconv: support changing frame sizes in codecs with frame mt.Ronald S. Bultje2012-03-24
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* threads: fix old frames returned after avcodec_flush_buffers()Uoti Urpala2012-03-16
| | | | | | | | | | Calling avcodec_flush_buffers() and then avcodec_decode_video2() with a 0-sized packet (to get remaining buffered frames) could incorrectly return an old frame from before the avcodec_flush_buffers() call. Add a loop in ff_thread_flush() to zero the got_frame field of each thread to ensure the old frames will not be returned. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavc: deprecate AVCodecContext.sub_id.Anton Khirnov2012-03-04
| | | | | | | In most places where it's used, it's as a pointless write-only field. Only rv10 decoder actually reads from it, but it stores some internal version info in it. There is no reason for it to be in a public field.
* lavc: reorder AVCodecContext fields.Anton Khirnov2012-02-27
| | | | | Put related fields together, move the important ones closer to the beginning, try to eliminate holes.
* threads: update slice_count and slice_offset from user contextJanne Grunau2012-01-21
| | | | | They are used to signal the number of slices and offsets of each slice out of band to the decoder.
* cosmetics: drop some pointless parenthesesDiego Biurrun2012-01-07
|
* win32: detect number of CPUs using affinityDaniel Verkamp2012-01-03
| | | | Signed-off-by: Janne Grunau <janne-libav@jannau.net>
* threads: limit the number of automatic threads to MAX_AUTO_THREADSJanne Grunau2012-01-01
| | | | | | The extra thread added in {frame_}*thread_init was not taken into account. Explicitly sets thread_count to 1 if only one CPU core was detected. Also fixes two typos in comments.
* threads: introduce CODEC_CAP_AUTO_THREADS and add it to libx264Janne Grunau2012-01-01
| | | | | | Some external codecs have their own code to determine the best number of threads. This number is not necessary the number of cpu cores. Thread_count will be only 0 if the codec has CODEC_CAP_AUTO_THREADS.
* threads: add sysconf based number of CPUs detectionJanne Grunau2011-12-31
| | | | Can act as fallback and should work on a couple of Unix systems.
* threads: always include necessary headers for number of CPUs detectionJanne Grunau2011-12-31
| | | | | | Since the conditions for the actual usage are more specific a less preferred method can be used. This would cause compilation errors because necessary headers are not included.
* threads: test for sys/param.h and include it for sysctl on OpenBSDJanne Grunau2011-12-27
|
* lavc: add format field to AVFrameStefano Sabatini2011-12-25
| | | | | | The format is a per-frame property, having it in AVFrame simplify the operation of extraction of that information, since avoids the need to access the codec/stream context.
* lavc: add width and height fields to AVFrameStefano Sabatini2011-12-25
| | | | | | width and height are per-frame properties, setting these values in AVFrame simplify the operation of extraction of that information, since avoids the need to check the codec/stream context.
* lavc: add a sample_aspect_ratio field to AVFrameStefano Sabatini2011-12-25
| | | | | | | The sample aspect ratio is a per-frame property, so it makes sense to define it in AVFrame rather than in the codec/stream context. Simplify application-level sample aspect ratio information extraction, and allow further simplifications.
* threads: check defines before using them in automatic thread detectionJanne Grunau2011-12-23
|
* pthread: include sys/types.h before sys/sysctl.hJanne Grunau2011-12-23
| | | | Fixes compilation on FreeBSD with clang 3.
* bsd: use number of logical CPUs as automatic thread countJanne Grunau2011-12-22
|
* windows: use number of CPUs as automatic thread countJanne Grunau2011-12-22
|
* linux: use number of CPUs as automatic thread countJanne Grunau2011-12-22
| | | | | | Use sched_getaffinity to determine the number of logical CPUs. Limits the number of threads to 16 since slice threading of H.264 seems to be buggy with more than 16 threads.