rtmpdump for WebRTC

BUILD.gn

  • 下载
    我把修改过后的上传到github上了,可以直接下载修改后的源码。
$ git clone git@github.com:momo0853/rtmpdump.git
  • 为rtmpdump添加GN编译BUILD.gn
#----------------------------------------------------
# Author: stoneliu
# Time  : Thu May  7 18:05:00 CST 2020
#----------------------------------------------------

config("public_config") {
  include_dirs = [ "." ]
}

config("librtmp_config") {
  if (is_win) {
    cflags = [
      "/wd4047",
      "/wd4310",
      "/wd4701",
      "/wd4005",
    ]
  } else {
    cflags = [
      "-Wno-unused-const-variable",
      "-Wno-sign-compare",
      "-Wno-delete-incomplete",
      "-Wno-deprecated-register",
      "-Wno-null-dereference",
      "-Wno-non-virtual-dtor",
      "-Wno-tautological-compare",
    ]
    ldflags = [ "-lz" ]
  }

  defines = [
    "RTMPDUMP_VERSION=\"2.4\"",
    "USE_OPENSSL",
  ]
}

static_library("librtmp") {
  sources = [
    "librtmp/amf.c",
    "librtmp/hashswf.c",
    "librtmp/log.c",
    "librtmp/parseurl.c",
    "librtmp/rtmp.c",
  ]

  configs += [ ":librtmp_config" ]
  public_configs = [ ":public_config" ]
  deps = [
    "//third_party/boringssl:boringssl",
  ]
}

executable("rtmpdump") {
  sources = [ "rtmpdump.c" ]
  deps = [ ":librtmp" ]
  configs += [ ":librtmp_config" ]
}

executable("rtmpgw") {
  sources = [ "rtmpgw.c", "thread.c" ]
  deps = [ ":librtmp" ]
  configs += [ ":librtmp_config" ]
}

executable("rtmpsrv") {
  sources = [ "rtmpsrv.c", "thread.c" ]
  deps = [ ":librtmp" ]
  configs += [ ":librtmp_config" ]
}

executable("rtmpsuck") {
  sources = [ "rtmpsuck.c", "thread.c" ]
  deps = [ ":librtmp" ]
  configs += [ ":librtmp_config" ]
}

rtmpdump使用BoringSSL

rtmpdump依赖OpenSSL的,但是这里我想用BoringSSL(因为WebRTC内部使用的是BoringSSL),这两个库的MDH数据结构的成员函数名字有点点差异,所以需要修改一下。自从2015年OpenSSL出现重大漏洞,Google大部分自身的开源项目都是依赖BoringSSL。

diff --git a/librtmp/dh.h b/librtmp/dh.h
index 5fc3f32..ff7b915 100644
--- a/librtmp/dh.h
+++ b/librtmp/dh.h
@@ -266,7 +266,7 @@ DHInit(int nKeyBits)

   MP_set_w(dh->g, 2);  /* base 2 */

-  dh->length = nKeyBits;
+  dh->priv_length = (unsigned)nKeyBits;
   return dh;

BoringSSL修改

rtmpdump依赖BIO_f_base64,但是BoringSSL并没有编译进去。

diff --git a/third_party/boringssl/BUILD.generated.gni b/third_party/boringssl/BUILD.generated.gni
index 0e96ff54f..c69befb38 100644
--- a/third_party/boringssl/BUILD.generated.gni
+++ b/third_party/boringssl/BUILD.generated.gni
@@ -329,6 +329,10 @@ crypto_sources = [
   "src/include/openssl/x509v3.h",
 ]

+crypto_sources += [
+  "src/decrepit/bio/base64_bio.c",
+]
+
 ssl_sources = [
   "src/include/openssl/dtls1.h",
   "src/include/openssl/ssl.h",
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值