[FFmpeg-cvslog] rtpdec_h264: Reorder code blocks

Martin Storsjö git at videolan.org
Sun May 6 22:18:57 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat May  5 00:38:05 2012 +0300| [3c148703f61d8862eb623484da1c679d55860148] | committer: Martin Storsjö

rtpdec_h264: Reorder code blocks

This removes one level of indentation.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c148703f61d8862eb623484da1c679d55860148
---

 libavformat/rtpdec_h264.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index d9b2700..784c5ec 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -137,26 +137,25 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
                 uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
                                           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,
-                           sizeof(start_sequence));
-                    memcpy(dest + codec->extradata_size + sizeof(start_sequence),
-                           decoded_packet, packet_size);
-                    memset(dest + codec->extradata_size + sizeof(start_sequence) +
-                           packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-                    codec->extradata       = dest;
-                    codec->extradata_size += sizeof(start_sequence) + 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,
+                       sizeof(start_sequence));
+                memcpy(dest + codec->extradata_size + sizeof(start_sequence),
+                       decoded_packet, packet_size);
+                memset(dest + codec->extradata_size + sizeof(start_sequence) +
+                       packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+                codec->extradata       = dest;
+                codec->extradata_size += sizeof(start_sequence) + packet_size;
             }
         }
         av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!",



More information about the ffmpeg-cvslog mailing list