[FFmpeg-devel] Realmedia patch

Luca Abeni lucabe72
Mon Sep 1 13:41:23 CEST 2008


Hi Ronald,

Ronald S. Bultje wrote:
[...]
      RTSPHeader reply1, *reply = &reply1;
-    char cmd[2048];
+    char cmd[2048], trans_pref[16];
+
+    if (rt->server_type == RTSP_SERVER_RDT)
+        strcpy(trans_pref, "x-pn-tng");
+    else
+        strcpy(trans_pref, "RTP/AVP");

I realize now that you could use
      const char *trans_pref;

      if (rt->server_type == RTSP_SERVER_RDT)
          trans_pref = "x-pn-tng";
      else
          trans_pref = "RTP/AVP";
saving some memory and a call to strcpy().

[...]
+        if (rt->server_type == RTSP_SERVER_RDT) {
+            char tmp[256], real_res[41], real_csum[9];
+            ff_rdt_calc_response_and_checksum(real_res, real_csum,
+                                              real_challenge);
+            snprintf(tmp, sizeof(tmp),
+                     "If-Match: %s\r\n"
+                     "RealChallenge2: %s, sd=%s\r\n",
+                     rt->session_id, real_res, real_csum);
+            av_strlcat(cmd, tmp, sizeof(cmd));

Cannot you use av_strlcatf() here?


				Luca




More information about the ffmpeg-devel mailing list