Browse code

rtpenc: Simplify code by introducing a separate end pointer

Also remove redundant parentheses.

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

Martin Storsjö authored on 2011/12/10 03:42:52
Showing 1 changed files
... ...
@@ -62,17 +62,17 @@ static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last
62 62
 
63 63
 void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size)
64 64
 {
65
-    const uint8_t *r;
65
+    const uint8_t *r, *end = buf1 + size;
66 66
     RTPMuxContext *s = s1->priv_data;
67 67
 
68 68
     s->timestamp = s->cur_timestamp;
69
-    r = ff_avc_find_startcode(buf1, buf1 + size);
70
-    while (r < buf1 + size) {
69
+    r = ff_avc_find_startcode(buf1, end);
70
+    while (r < end) {
71 71
         const uint8_t *r1;
72 72
 
73 73
         while(!*(r++));
74
-        r1 = ff_avc_find_startcode(r, buf1 + size);
75
-        nal_send(s1, r, r1 - r, (r1 == buf1 + size));
74
+        r1 = ff_avc_find_startcode(r, end);
75
+        nal_send(s1, r, r1 - r, r1 == end);
76 76
         r = r1;
77 77
     }
78 78
 }