oRTP の RECVONLY セッションで RTCP を受信しようとすると、現在 segfault が発生します。RTCP は、SENDRECV セッションでの受信時には正常に機能しますが、RECVONLY セッションでは機能しません。
これは私のコードです。segfault は、42 行目の関数から発生します。これは、ファイルを受け取る while ループにあります。
ただし、これは 32 行目でのみ発生します。
rtp_session_enable_rtcp(セッション、TRUE); TRUE に設定されています。
RTCP を FALSE に設定して無効にすると、RECVONLY セッションが機能します。
#include <ortp/ortp.h>
#include <bctoolbox/vfs.h>
#include <signal.h>
#include <stdlib.h>
int cond=1;
void stop_handler(int signum)
{
cond=0;
}
int main(int argc, char*argv[])
{
RtpSession *session;
unsigned char buffer[160];
int err;
uint32_t ts=0;
int stream_received=0;
FILE *outfile;
int local_port;
int have_more;
int i;
local_port=atoi(argv[2]);
outfile=fopen(argv[1],"wb");
//initialization of the session
ortp_init();
ortp_scheduler_init();
ortp_set_log_level_mask(NULL, ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
signal(SIGINT,stop_handler);
session=rtp_session_new(RTP_SESSION_RECVONLY);
rtp_session_enable_rtcp(session,TRUE);
rtp_session_set_scheduling_mode(session,1);
rtp_session_set_blocking_mode(session,1);
rtp_session_set_local_addr(session,"0.0.0.0",local_port,local_port+1);
rtp_session_set_payload_type(session,0);
//receiving of incoming file
while(cond)
{
have_more=1;
while (have_more){
err=rtp_session_recv_with_ts(session,buffer,160,ts,&have_more);
if (err>0) stream_received=1;
/* this is to avoid to write to disk some silence before the first RTP packet is returned*/
if ((stream_received) && (err>0)) {
size_t ret = fwrite(buffer,1,err,outfile);
}
}
ts+=160;
}
rtp_session_destroy(session);
ortp_exit();
ortp_global_stats_display();
return 0;
}
gdb を使用してデバッグすると、segfault のこのバックトレースが得られます。
Thread 1 "err" received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd0a53 in concatb (mp=mp@entry=0x606ec0, newm=newm@entry=0x0)
at /usr/src/debug/ortp-1.0.1-18/src/str_utils.c:337
337 while(newm->b_cont!=NULL) newm=newm->b_cont;
(gdb) bt
#0 0x00007ffff7bd0a53 in concatb (mp=mp@entry=0x606ec0, newm=newm@entry=0x0)
at /usr/src/debug/ortp-1.0.1-18/src/str_utils.c:337
#1 0x00007ffff7bc4ada in append_sdes (full=1 '\001', m=0x606ec0, session=0x602750)
at /usr/src/debug/ortp-1.0.1-18/src/rtcp.c:397
#2 rtp_session_create_and_send_rtcp_packet (session=session@entry=0x602750, full=full@entry=1 '\001')
at /usr/src/debug/ortp-1.0.1-18/src/rtcp.c:460
#3 0x00007ffff7bc4d3e in rtp_session_send_regular_rtcp_packet_and_reschedule (
session=session@entry=0x602750, tc=607522024) at /usr/src/debug/ortp-1.0.1-18/src/rtcp.c:569
#4 0x00007ffff7bc4ebd in rtp_session_run_rtcp_send_scheduler (session=session@entry=0x602750)
at /usr/src/debug/ortp-1.0.1-18/src/rtcp.c:604
#5 0x00007ffff7bc5085 in rtp_session_rtcp_process_recv (session=session@entry=0x602750)
at /usr/src/debug/ortp-1.0.1-18/src/rtcp.c:620
#6 0x00007ffff7bca985 in rtp_session_recvm_with_ts (session=session@entry=0x602750,
user_ts=user_ts@entry=30880) at /usr/src/debug/ortp-1.0.1-18/src/rtpsession.c:1287
#7 0x00007ffff7bcab24 in rtp_session_recv_with_ts (session=0x602750,
buffer=0x7fffffffdf90 "\226ˢT\277\274\350/։c\276e\257\377\377\377\377\376\177\357\377\377\377\277\372\377\377\377\377\377\377\377\356?r\337\301h\225s`\020HvHfJv\312\062\364\332\333\036\364\332fͽL\002\220d\"\206\354b\006\003\060\241cHV21\243Z!\v\r\202\271\214x0\004Pc$\306<\306\006;\270i\352\206l\030`\244@\244\303\071\253\070\"T\356\002\017\004\"8e\377\062\260\225\376\245bG\310\320H", len=160, ts=30880, have_more=0x7fffffffdf8c)
at /usr/src/debug/ortp-1.0.1-18/src/rtpsession.c:1364
#8 0x0000000000400d15 in main ()
バックトレースから、ライブラリ ファイル str_utils.c に問題があるように見えますが、RECVONLY セッションをセットアップするときに何かを初期化するのを忘れているだけなのかどうかはわかりません。
全体として、42 行目のレシーバ機能は、RECVONLY セッションの RTCP では機能しないように見えます。RTCP が無効になっていても問題はありません。