Skip to content

Instantly share code, notes, and snippets.

View happyj2me's full-sized avatar

kevin happyj2me

View GitHub Profile
1. 输入编码器的帧率,分辨率控制
PeerConnectionClient.java::createVideoTrack方法里面 加入一行 changeCaptureFormat(videoWidth,videoHeight,videoFps);
2. 编码器目标码率设置
PeerConnectionClient.java::onLocalDescription方法里面,调用setVideoMaxBitrate方法进行设置,该方法主体如下:
RtpParameters parameters = localVideoSender.getParameters();
if (parameters.encodings.size() == 0) {
Log.w(TAG, "RtpParameters are not ready.");
return;
}
@happyj2me
happyj2me / readelf
Last active September 2, 2019 03:27
ar -x libscy.a
readelf -s -W logger.cpp.o | grep Rotating
306: 0000000000000000 1405 FUNC GLOBAL DEFAULT 181 _ZN3scy19RotatingFileChannel5writeERKNS_9LogStreamE
307: 0000000000000000 3092 FUNC GLOBAL DEFAULT 183 _ZN3scy19RotatingFileChannel6rotateEv
308: 0000000000000000 1221 FUNC GLOBAL DEFAULT 175 _ZN3scy19RotatingFileChannelC1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_NS_5LevelES7_iS7_
309: 0000000000000000 1221 FUNC GLOBAL DEFAULT 175 _ZN3scy19RotatingFileChannelC2ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_NS_5LevelES7_iS7_
310: 0000000000000000 40 FUNC GLOBAL DEFAULT 179 _ZN3scy19RotatingFileChannelD0Ev
311: 0000000000000000 367 FUNC GLOBAL DEFAULT 177 _ZN3scy19RotatingFileChannelD1Ev
312: 0000000000000000 367 FUNC GLOBAL DEFAULT 177 _ZN3scy19RotatingFileChannelD2Ev
527: 0000000000000230 24 OBJECT GLOBAL DEFAULT 443 _ZTIN3scy19RotatingFileChannelE
int connect_timeout(int sockfd, const struct sockaddr *addr,
socklen_t addrlen, struct timeval *timeout)
{
int flags = fcntl( sockfd, F_GETFL, 0 );
if (flags == -1) {
return -1;
}
if (fcntl( sockfd, F_SETFL, flags | O_NONBLOCK ) < 0) {
return -1;
}
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)
{
@happyj2me
happyj2me / webrtc
Last active October 14, 2023 14:28
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
I420: YYYYYYYYUUVV (x264编码器的输入数据格式)
NV12: YYYYYYYYUVUV (media codec 喜欢这个格式的数据)
NV21: YYYYYYYYVUVU (android camera 回调的yuv数据格式)
http://www.artvc-mcu.top:9000/webrtc.xhtml
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));
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
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 : 调到某一行