1 修改video_loopback.cc中,设置duration的代码,使其大于0.如下
WEBRTC_DEFINE_int(
duration,
1,//change from 0
"Duration of the test in seconds. If 0, rendered will be shown instead.");
int DurationSecs() {
return static_cast<int>(FLAG_duration);
}
2 修改video_loopback.cc中,设置rtp包保存的代码,设置一个文件名,如下
WEBRTC_DEFINE_string(rtp_dump_name,
"new.rtp", //add
"Filename for dumped received RTP stream.");
std::string RtpDumpName() {
return static_cast<std::string>(FLAG_rtp_dump_name);
}
3 编译webrtc
ninja -C out/linux/
4 运行./out/linux的video_loopback文件,生成new.rtp
root@TM1607:~/webrtc-tt/webrtc-checkout/src/out/linux# ./video_loopback
Writing rtp dump to new.rtp
[OpenH264] this = 0x0x7f163c001850, Warning:Change QP Range from(0,51) to (12,42)
RESULT psnr: video= {42.981244,0.98009309} dB
RESULT ssim: video= {0.97726459,0.003650892} score
RESULT sender_time: video= {14.346154,14.082019} ms
RESULT receiver_time: video= {11.307692,6.3474358} ms
RESULT network_time: video= {2,2.8419928} ms
RESULT total_delay_incl_network: video= {27.653846,15.251588} ms
RESULT time_between_rendered_frames: video= {35.72,11.130211} ms
RESULT encode_frame_rate: video= {27,0} fps
RESULT encode_time: video= {0,0} ms
RESULT media_bitrate: video= {676415,0} bps
RESULT fec_bitrate: video= {0,0} bps
RESULT send_bandwidth: video= {1272525,0} bps
RESULT time_between_freezes: video= {893,0} ms
RESULT min_psnr: video= 39.976028 dB
RESULT decode_time: video= {1,0} ms
RESULT dropped_frames: video= 4 frames
RESULT cpu_usage: video= 18.324796 %
5 在columbia的cs官网上,下载rtptools,然后configure和make.
6 得到rtpdump和rtpplay的可执行文件后,开启wireshark抓127.0.0.1的包,并运行收发包程序,发送刚才生成的new.rtp
./rtpdump 127.0.0.1/1234
./rtpplay -f new.rtp 127.0.0.1/1234
7 wireshark可得到想要的rtp包,并可以进行分析.