[FFmpeg-devel] [PATCH 2/4] lavfi/avfilter: simplify filter registration

Rostislav Pehlivanov atomnuker at gmail.com
Mon Nov 27 06:30:19 EET 2017


Atomics were entirely pointless and did nothing but slow and complicate
the process down. This could be improved further still but the main
objective of this commit is to simplify.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
---
 libavfilter/avfilter.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b98b32bacb..6b98e77a8e 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -19,7 +19,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/atomic.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/buffer.h"
@@ -599,8 +598,11 @@ int avfilter_register(AVFilter *filter)
 
     filter->next = NULL;
 
-    while(*f || avpriv_atomic_ptr_cas((void * volatile *)f, NULL, filter))
-        f = &(*f)->next;
+    /* Iterate through the list until the last entry has been reached */
+    do {
+        *f = filter;
+        f  = &filter->next;
+    } while (*f);
     last_filter = &filter->next;
 
     return 0;
-- 
2.15.0.417.g466bffb3ac



More information about the ffmpeg-devel mailing list