Intel WebRTC之woogeen_config.js文件内容示例

本文详细介绍了IntelWebRTC项目的woogeen_config.js配置文件内容,包括常见配置项、云提供商设置、Nuve配置、ErizoController及ErizoAgent等组件的具体参数说明。

Intel WebRTC之woogeen_config.js文件内容示例

最近在解决 stun, turn,ICE 相关问题时看到此文件,这里记录一下。

请注意,在新的版本 Release-v3.2.1 中已经不存在此文件。

var config = {}

/*********************************************************
 COMMON CONFIGURATION
 It's used by Nuve, ErizoController, ErizoAgent and ErizoJS
**********************************************************/
config.rabbit = {};
config.rabbit.host = 'localhost'; //default value: 'localhost'
config.rabbit.port = 5672; //default value: 5672
config.logger = {};
config.logger.config_file = '../log4js_configuration.json'; //default value: "../log4js_configuration.json"

/*********************************************************
 CLOUD PROVIDER CONFIGURATION
 It's used by Nuve and ErizoController
**********************************************************/
config.cloudProvider = {};
config.cloudProvider.name = '';
//In Amazon Ec2 instances you can specify the zone host. By default is 'ec2.us-east-1a.amazonaws.com' 
config.cloudProvider.host = '';
config.cloudProvider.accessKey = '';
config.cloudProvider.secretAccessKey = '';

config.certificate = {};
// A string or Buffer containing the certificate key of the server in PEM format. (Required)
config.certificate.cert = "../../cert/cert.pem";
// A string or Buffer containing the private key of the server in PEM format. (Required)
config.certificate.key =  "../../cert/key.pem";

config.certificate.cert2="/home/oracle/Release-v2.0/extras/basic_example/cert/cert.crt"
config.certificate.key2 ="/home/oracle/Release-v2.0/extras/basic_example/cert/cert.key"

// A string of passphrase for the private key or pfx
config.certificate.passphrase = "";
// An array of strings or Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used to authorize connections.
config.certificate.ca = "";

/*********************************************************
 NUVE CONFIGURATION
**********************************************************/
config.nuve = {};
config.nuve.dataBaseURL = "localhost/nuvedb"; // default value: 'localhost/nuvedb'
config.nuve.superserviceID = '54c100fa11274c36bb58785e'; // default value: ''
config.nuve.superserviceKey = '5555'; // default value: ''
config.nuve.testErizoController = 'localhost:443'; // default value: 'localhost:8080'

/*********************************************************
 ERIZO CONTROLLER CONFIGURATION
**********************************************************/
config.erizoController = {};

//Use undefined to run clients without Stun 
config.erizoController.stunServerUrl = undefined; // default value: 'stun:stun.l.google.com:19302'

// Default and max video bandwidth parameters to be used by clients
config.erizoController.defaultVideoBW = 300; //default value: 300
config.erizoController.maxVideoBW = 2048; //default value: 300

// Public erizoController IP for websockets (useful when behind NATs)
// Use '' to automatically get IP from the interface
config.erizoController.publicIP = '136.243.22.156'; //default value: ''
// Use '' to use the public IP address instead of a hostname
config.erizoController.hostname = 'vs03.pruffme.com'; //default value: ''
config.erizoController.port = 443; //default value: 8080
// Use true if clients communicate with erizoController over SSL
config.erizoController.ssl = true; //default value: false

// Use the name of the inferface you want to bind to for websockets
// config.erizoController.networkInterface = 'eth1' // default value: undefined

//Use undefined to run clients without Turn
config.erizoController.turnServer = {}; // default value: undefined
config.erizoController.turnServer.url = 'turn:144.76.17.69:3478'; // default value: null
config.erizoController.turnServer.username = 'pruffme'; // default value: null
config.erizoController.turnServer.password = 'pruffme'; // default value: null

config.erizoController.warning_n_rooms = 50; // default value: 15
config.erizoController.limit_n_rooms = 100; // default value: 20
config.erizoController.interval_time_keepAlive = 1000; // default value: 1000

// Roles to be used by services
config.erizoController.roles =
{"presenter": {"publish": true, "subscribe": true, "record": true},
    "viewer": {"subscribe": true},
    "viewerWithData": {"subscribe": true, "publish": {"audio": false, "video": false, "screen": false, "data": true}}}; // default value: {"presenter":{"publish": true, "subscribe":true, "record":true}, "viewer":{"subscribe":true}, "viewerWithData":{"subscribe":true, "publish":{"audio":false,"video":false,"screen":false,"data":true}}}

// If true, erizoController sends stats to rabbitMQ queue "stats_handler" 
config.erizoController.sendStats = false; // default value: false

// If undefined, the path will be /tmp/
config.erizoController.recording_path = undefined; // default value: undefined

// If true, the streams from different clients in a room will be mixed by the media server.
config.erizoController.mixer = false;

// If true and the maxProcesses allows, the mixer will be run in a dedicated process.
config.erizoController.outOfProcessMixer = false;

/*********************************************************
 ERIZO AGENT CONFIGURATION
**********************************************************/
config.erizoAgent = {};

// Max processes that ErizoAgent can run
config.erizoAgent.maxProcesses 	  = 50; // default value: 13
// Number of precesses that ErizoAgent runs when it starts. Always lower than or equals to maxProcesses.
config.erizoAgent.prerunProcesses = 1; // default value: 1

/*********************************************************
 ERIZO JS CONFIGURATION
**********************************************************/
config.erizo = {};

//STUN server IP address and port to be used by the server.
//if '' is used, the address is discovered locally
config.erizo.stunserver = ''; // default value: ''
config.erizo.stunport = 0; // default value: 0

//note, this won't work with all versions of libnice. With 0 all the available ports are used
config.erizo.minport = 0; // default value: 0
config.erizo.maxport = 0; // default value: 0

// If true and the machine has the capability, the mixer will be accelerated by hardware graphic chips.
config.erizo.hardwareAccelerated = false;

// This configuration is only for software media engine. Hardware graphic acceleration provides H.264 by default.
// "true" means OpenH264 is deployed for H.264. Otherwise no support of H.264 in MCU.
config.erizo.openh264Enabled = false;

// Config the mixed video layout. Default is "fluid" layout.
// Otherwise, "custom" layout can be used for video layout customization.
config.erizo.videolayout = {};
config.erizo.videolayout.type = "fluid";
config.erizo.videolayout.defaultrootsize = "vga"; // Default 640x480 root size. See docs for more details.
config.erizo.videolayout.defaultbackgroundcolor = "black"; // Default black root background color . See docs for more details.

/***** END *****/
// Following lines are always needed.
var module = module || {};
module.exports = config;


<think>我们正在讨论两个GStreamer头文件:`gst/gst.h` 和 `gst/webrtc/webrtc_fwd.h`。这两个头文件在GStreamer框架中扮演不同的角色,特别是在开发WebRTC应用程序时可能会用到。下面我将分别解释它们的内容和作用。 ### 1. `gst/gst.h` - 核心头文件 **作用**: 这是GStreamer框架的**核心头文件**,任何使用GStreamer库的应用程序都必须包含此文件。它提供了对GStreamer核心功能的访问,包括: - GStreamer初始化函数 (`gst_init()`) - 基本对象类型(如`GstElement`, `GstPad`, `GstBuffer`等) - 消息处理机制(如`GstBus`, `GstMessage`) - 插件系统接口 - 数据类型和宏定义 **内容示例**(简化版): ```c // GStreamer初始化 void gst_init(int *argc, char ***argv); // 主要对象类型 typedef struct _GstElement GstElement; typedef struct _GstPad GstPad; typedef struct _GstBuffer GstBuffer; // 创建元素 GstElement* gst_element_factory_make(const gchar *factoryname, const gchar *name); ``` **开发场景**: 在编译基础GStreamer应用时,如果缺少此头文件,会出现类似`gst/gst.h: No such file or directory`的错误[^2]。解决方法是确保编译命令包含正确的pkg-config路径: ```bash gcc your_app.c -o app `pkg-config --cflags --libs gstreamer-1.0` ``` ### 2. `gst/webrtc/webrtc_fwd.h` - WebRTC模块前向声明 **作用**: 此头文件属于GStreamer的**WebRTC模块**(`gst-plugins-bad`中的插件),专门提供WebRTC相关功能的前向声明(Forward Declarations)。主要目的是: - 避免头文件循环依赖 - 加速编译过程(减少重复编译) - 声明WebRTC核心对象的不完整类型(如`GstWebRTCBin`, `GstWebRTCDataChannel`) **内容示例**: ```c // 前向声明(不暴露结构体细节) typedef struct _GstWebRTCBin GstWebRTCBin; typedef struct _GstWebRTCDataChannel GstWebRTCDataChannel; ``` **开发场景**: 当开发WebRTC应用时,如果代码只需要引用类型而不访问其内部结构(例如声明指针),应包含此轻量级头文件而非完整定义的头文件(如`gst/webrtc/webrtc.h`)。这能显著提升编译效率。 --- ### 关键区别总结 | 特性 | `gst/gst.h` | `gst/webrtc/webrtc_fwd.h` | |---------------------|--------------------------------|--------------------------------| | **定位** | 核心功能(所有应用必需) | WebRTC模块专用(可选) | | **内容类型** | 完整类型定义和API | 仅前向声明 | | **编译依赖** | 高(包含大量实现) | 低(仅类型声明) | | 典型错误 | `gst/gst.h: No such file`[^2] | `webrtc_fwd.h: No such file` | | 解决方案 | 检查`pkg-config`路径[^1] | 确保安装`gstreamer-webrtc`开发包 | --- ### 开发建议 1. **基础应用**:只需包含`gst/gst.h`即可构建媒体管道[^1]。 2. **WebRTC应用**: - 在头文件中优先使用`webrtc_fwd.h`(仅声明指针) - 在实现文件中包含完整头文件`gst/webrtc/webrtc.h` ```c // myapp.h #include <gst/webrtc/webrtc_fwd.h> void handle_data_channel(GstWebRTCDataChannel *channel); // myapp.c #include <gst/webrtc/webrtc.h> // 获取完整API ``` 3. **编译配置**: 添加WebRTC模块的编译选项: ```bash gcc webrtc_app.c -o app `pkg-config --cflags --libs gstreamer-webrtc-1.0` ``` --- ### 常见问题排查 **问题**:编译时找不到`gst/webrtc/*.h` **原因**:未安装开发包或路径配置错误 **解决**: ```bash # 安装GStreamer WebRTC开发包 sudo apt install libgstreamer-plugins-bad1.0-dev # 验证头文件路径 pkg-config --cflags gstreamer-webrtc-1.0 # 应输出:-I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include ``` > **提示**:DeepStream等高级框架可能需要额外路径配置(如添加`-I/usr/local/include/gstreamer-1.0`[^4])。 --- §§相关问题§§ 1. 如何在CMake项目中正确配置GStreamer的依赖项? 2. GStreamer WebRTC模块提供了哪些核心API? 3. 前向声明(Forward Declaration)在C语言中有什么优势和风险? 4. 如何为自定义GStreamer插件添加WebRTC支持? 5. 编译GStreamer应用时出现"undefined reference to `gst_init'"错误如何解决?</think>### GStreamer 头文件解析:`gst/gst.h` 与 `gst/webrtc/webrtc_fwd.h` #### 1. **`gst/gst.h` - 核心框架头文件** **作用**: 这是 GStreamer 的**核心头文件**,包含框架的基础定义和 API,相当于 GStreamer 开发的"入口点"。任何使用 GStreamer 的应用程序都必须包含此文件。 **关键内容**: ```c // GStreamer 初始化函数(必须调用) void gst_init(int *argc, char ***argv); // 核心对象类型定义 typedef struct _GstElement GstElement; // 元素(管道组件) typedef struct _GstPad GstPad; // 数据连接点 typedef struct _GstBuffer GstBuffer; // 数据传输单元 typedef struct _GstBus GstBus; // 消息总线 // 核心 API 函数 GstElement* gst_element_factory_make(const gchar *factoryname, const gchar *name); // 创建元素 GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state); // 设置状态 ``` **典型使用场景**: ```c #include <gst/gst.h> // 必须包含 int main() { gst_init(NULL, NULL); // 初始化 GStreamer GstElement *pipeline = gst_pipeline_new("my-pipeline"); // ... 构建管道逻辑 } ``` > **编译依赖**:若缺失此头文件,会出现 `gst/gst.h: No such file or directory` 错误[^2],需通过 pkg-config 添加路径: > ```bash > gcc app.c -o app `pkg-config --cflags --libs gstreamer-1.0` > ``` --- #### 2. **`gst/webrtc/webrtc_fwd.h` - WebRTC 前向声明** **作用**: 专为 GStreamer 的 **WebRTC 模块**设计,提供**前向声明(Forward Declarations)**。主要用途: 1. 避免头文件循环依赖 2. 加速编译过程 3. 声明 WebRTC 核心对象的不完整类型 **关键内容**: ```c // WebRTC 核心对象的前向声明 typedef struct _GstWebRTCBin GstWebRTCBin; // WebRTC 核心容器 typedef struct _GstWebRTCDataChannel GstWebRTCDataChannel; // 数据通道 typedef struct _GstWebRTCICEStream GstWebRTCICEStream; // ICE 传输层 // 函数指针类型声明 typedef void (*GstWebRTCDataChannelOnMessage)(GstWebRTCDataChannel *channel, ...); ``` **典型使用场景**: ```c // 在头文件中使用前向声明(避免包含完整定义) #include <gst/webrtc/webrtc_fwd.h> // 仅声明指针类型(不暴露结构细节) void configure_webrtc(GstWebRTCBin *webrtcbin); // 在实现文件中包含完整定义 #include <gst/webrtc/webrtc.h> ``` --- ### 关键区别总结 | 特性 | `gst/gst.h` | `gst/webrtc/webrtc_fwd.h` | |---------------------|--------------------------------|--------------------------------| | **定位** | 核心框架(必需) | WebRTC 模块专用(可选) | | **内容类型** | 完整类型定义 + API | 前向声明(不完整类型) | | **编译依赖** | 高(包含大量实现) | 极低(仅类型声明) | | 典型错误 | `gst/gst.h: No such file`[^2] | `webrtc_fwd.h: No such file` | | 解决方案 | 检查 pkg-config 路径[^1] | 安装 `gstreamer-webrtc` 开发包 | --- ### 开发建议 1. **基础管道开发** 只需包含 `gst/gst.h`,如教程中的基础示例[^1]: ```c #include <gst/gst.h> // 无需包含 webrtc_fwd.h ``` 2. **WebRTC 应用开发** - 头文件:优先使用 `webrtc_fwd.h` 减少依赖 - 实现文件:包含完整定义 `#include <gst/webrtc/webrtc.h>` ```c // myapp.h #include <gst/webrtc/webrtc_fwd.h> void setup_datachannel(GstWebRTCDataChannel *channel); // 仅声明指针 // myapp.c #include <gst/webrtc/webrtc.h> // 获取完整API ``` 3. **编译配置** 添加 WebRTC 模块的编译选项: ```bash gcc webrtc_app.c -o app `pkg-config --cflags --libs gstreamer-webrtc-1.0` ``` 若头文件路径异常(如 DeepStream 环境[^4]),需手动指定: ```makefile CFLAGS += -I/usr/local/include/gstreamer-1.0 ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值