diff mbox series

[FFmpeg-devel,13/13] avcodec/omx: Reindentation

Message ID AM7PR03MB6660D40737DCF590BC324A2E8FCE9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit bc75fb54238091dd88e9acd4d4e6225b08dbf17c
Headers show
Series [FFmpeg-devel,01/13] avcodec/vp9: Do not destroy uninitialized mutexes/conditions | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Andreas Rheinhardt Sept. 2, 2021, 3:41 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/omx.c | 62 ++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index 7086ddd3a4..4078ac84a4 100644
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -596,45 +596,45 @@  static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
 
 static av_cold void cleanup(OMXCodecContext *s)
 {
-    int i, executing;
+    int executing;
 
     /* If the mutexes/condition variables have not been properly initialized,
      * nothing has been initialized and locking the mutex might be unsafe. */
     if (s->mutex_cond_inited_cnt == NB_MUTEX_CONDS) {
-    pthread_mutex_lock(&s->state_mutex);
-    executing = s->state == OMX_StateExecuting;
-    pthread_mutex_unlock(&s->state_mutex);
+        pthread_mutex_lock(&s->state_mutex);
+        executing = s->state == OMX_StateExecuting;
+        pthread_mutex_unlock(&s->state_mutex);
 
-    if (executing) {
-        OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
-        wait_for_state(s, OMX_StateIdle);
-        OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL);
-        for (i = 0; i < s->num_in_buffers; i++) {
-            OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond,
-                                                      &s->num_free_in_buffers, s->free_in_buffers, 1);
-            if (s->input_zerocopy)
-                buffer->pBuffer = NULL;
-            OMX_FreeBuffer(s->handle, s->in_port, buffer);
+        if (executing) {
+            OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
+            wait_for_state(s, OMX_StateIdle);
+            OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL);
+            for (int i = 0; i < s->num_in_buffers; i++) {
+                OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond,
+                                                        &s->num_free_in_buffers, s->free_in_buffers, 1);
+                if (s->input_zerocopy)
+                    buffer->pBuffer = NULL;
+                OMX_FreeBuffer(s->handle, s->in_port, buffer);
+            }
+            for (int i = 0; i < s->num_out_buffers; i++) {
+                OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond,
+                                                        &s->num_done_out_buffers, s->done_out_buffers, 1);
+                OMX_FreeBuffer(s->handle, s->out_port, buffer);
+            }
+            wait_for_state(s, OMX_StateLoaded);
         }
-        for (i = 0; i < s->num_out_buffers; i++) {
-            OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond,
-                                                      &s->num_done_out_buffers, s->done_out_buffers, 1);
-            OMX_FreeBuffer(s->handle, s->out_port, buffer);
+        if (s->handle) {
+            s->omx_context->ptr_FreeHandle(s->handle);
+            s->handle = NULL;
         }
-        wait_for_state(s, OMX_StateLoaded);
-    }
-    if (s->handle) {
-        s->omx_context->ptr_FreeHandle(s->handle);
-        s->handle = NULL;
-    }
 
-    omx_deinit(s->omx_context);
-    s->omx_context = NULL;
-    av_freep(&s->in_buffer_headers);
-    av_freep(&s->out_buffer_headers);
-    av_freep(&s->free_in_buffers);
-    av_freep(&s->done_out_buffers);
-    av_freep(&s->output_buf);
+        omx_deinit(s->omx_context);
+        s->omx_context = NULL;
+        av_freep(&s->in_buffer_headers);
+        av_freep(&s->out_buffer_headers);
+        av_freep(&s->free_in_buffers);
+        av_freep(&s->done_out_buffers);
+        av_freep(&s->output_buf);
     }
     ff_pthread_free(s, omx_codec_context_offsets);
 }