[11/11] rtpdec_h264: Reorder code blocks

Message ID 1336169215-59789-11-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö May 4, 2012, 10:06 p.m.
This removes one level of indentation.
---
 libavformat/rtpdec_h264.c |   31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

Comments

Luca Barbato May 5, 2012, 12:02 a.m. | #1
On 04/05/12 15:06, Martin Storsjö wrote:
> This removes one level of indentation.
> ---
>  libavformat/rtpdec_h264.c |   31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)

Ok.

Patch

diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 5ff03ee..f2dd06c 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -134,26 +134,25 @@  static int sdp_parse_fmtp_config_h264(AVStream *stream,
                 uint8_t *dest = av_malloc(packet_size + START_SEQ_SIZE +
                                           codec->extradata_size +
                                           FF_INPUT_BUFFER_PADDING_SIZE);
-                if (dest) {
-                    if (codec->extradata_size) {
-                        memcpy(dest, codec->extradata, codec->extradata_size);
-                        av_free(codec->extradata);
-                    }
-
-                    memcpy(dest + codec->extradata_size, start_sequence,
-                           START_SEQ_SIZE);
-                    memcpy(dest + codec->extradata_size + START_SEQ_SIZE,
-                           decoded_packet, packet_size);
-                    memset(dest + codec->extradata_size + START_SEQ_SIZE +
-                           packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-                    codec->extradata = dest;
-                    codec->extradata_size += START_SEQ_SIZE + packet_size;
-                } else {
+                if (!dest) {
                     av_log(codec, AV_LOG_ERROR,
                            "Unable to allocate memory for extradata!");
                     return AVERROR(ENOMEM);
                 }
+                if (codec->extradata_size) {
+                    memcpy(dest, codec->extradata, codec->extradata_size);
+                    av_free(codec->extradata);
+                }
+
+                memcpy(dest + codec->extradata_size, start_sequence,
+                       START_SEQ_SIZE);
+                memcpy(dest + codec->extradata_size + START_SEQ_SIZE,
+                       decoded_packet, packet_size);
+                memset(dest + codec->extradata_size + START_SEQ_SIZE +
+                       packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+                codec->extradata = dest;
+                codec->extradata_size += START_SEQ_SIZE + packet_size;
             }
         }
         av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!",