This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
总结一下,在默认情况下,栈只能得到1M大小的内存,全局静态储存可以得到2G,而在32位和64位下的堆则可以得到2G和无限内存(一般不会用到16T) | |
一个由C/C++编译的程序占用的内存分为以下几个部分: | |
1、栈区(stack)— 由编译器自动分配释放,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。 | |
2、堆区(heap) — 一般由程序员分配释放,若程序员不释放,程序结束时可能由OS(操作系统)回收。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表。 | |
3、全局区(静态区)(static)—,全局变量和静态变量的存储是放在一块的,初始化的全局变量和静态变量在一块区域,未初始化的全局变量和未初始化的静态变量在相邻的另一块区域。程序结束后由系统释放。 | |
4、文字常量区 —常量字符串就是放在这里的。程序结束后由系统释放。 | |
5、程序代码区—存放函数体的二进制代码。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.当以下编码参数更改时file format/number and type of tracks/encoding parameters/encoding sequence/timestamp sequence, | |
需要在m3u8中加入#EXT-X-DISCONTINUITY隔离开,让播放器重新初始化。 | |
规范: | |
https://tools.ietf.org/html/draft-pantos-http-live-streaming-13#section-3.4.11 | |
2.应用场景: | |
1)轮播不用的影片。 | |
2)插入广告 | |
3.例子: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Mac", | |
"includePath": [ | |
"${workspaceFolder}/**", | |
"/Library/Developer/CommandLineTools/usr/include/c++/v1", | |
"/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include", | |
"/Library/Developer/CommandLineTools/usr/include", | |
"/usr/include", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xcode: | |
1. shift + command + o : 全局查找某个类文件 | |
2. contr + command + 左键 : 函数跳转 | |
3. contr + command + -> : h跳转到cc文件 | |
4. optio + command + -> : 函数定义折叠 | |
vscode: https://nshen.net/article/2015-11-20/vscode/ | |
1. ctrl + shift + p or ctrl + p : 进入两种模式,可以查找文件等, 增删<符号可以在两种模式之间切换 | |
2. ctrl + shift + n or ctrl + shit + w : 打开关闭一个窗口 | |
3. ctrl + g : 调到某一行 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.获取webrtc代码拉取以及编译的工具 | |
cd /home/kevin/webrtc | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
export PATH=/home/kevin/webrtc/depot_tools:$PATH | |
2. 获取webrtc-master分支的最新代码 | |
cd /home/kevin/webrtc/linux | |
fetch --no-hooks webrtc_android | |
gclient sync | |
cd src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.绑定到一个操作系统随机分配的udp端口,绑定成功后获取到这个端口 | |
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | |
if(fd < 0) { | |
JANUS_LOG(LOG_ERR, "Error creating RTCP socket for new RTP forwarder... %d (%s)\n", | |
errno, strerror(errno)); | |
return 0; | |
} | |
struct sockaddr_in address; | |
socklen_t len = sizeof(address); | |
memset(&address, 0, sizeof(address)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.artvc-mcu.top:9000/webrtc.xhtml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I420: YYYYYYYYUUVV (x264编码器的输入数据格式) | |
NV12: YYYYYYYYUVUV (media codec 喜欢这个格式的数据) | |
NV21: YYYYYYYYVUVU (android camera 回调的yuv数据格式) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.linux平台, webrtc抽取出来静态库和头文件,先用ninja编译完webrtc,然后进入src/out/linux目录(假设src目录下是webrtc相关的代码) | |
1.1 提取所有的.o生成libwebrtc_full.a | |
.ninja_log 里面可以找到所有的.a ; .ninja_deps里面可以找到所有的.o, 但建议用.a去构建最终的静态库 | |
cat libwebrtc_full.ar | |
CREATE libwebrtc_full.a | |
ADDLIB obj/third_party/boringssl/libboringssl.a | |
ADDLIB obj/third_party/protobuf/libprotobuf_full.a | |
ADDLIB obj/libwebrtc.a | |
SAVE | |
END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://senlinzhan.github.io/2017/08/20/libevent-buffer/ | |
#include <event2/listener.h> | |
#include <event2/bufferevent.h> | |
#include <event2/buffer.h> | |
#include <arpa/inet.h> | |
#include <string.h> | |
#include <iostream> | |
void echo_read_cb(struct bufferevent *bev, void *ctx) | |
{ |
OlderNewer