2016-06-14 6 views
0

https://github.com/BelledonneCommunications/mediastreamer2 https://github.com/BelledonneCommunications/linphone-android시작 Linphone MediaStreamer2 오디오 및 비디오 스트림 함께

만 mediastreamer2 라이브러리를 사용하여 I 원격 IP 및 포트 주어지고 각각의 방법을 audiostream.c 전화와 음성 통화를 시작할 수입니다.

화상 통화를 시작해야했습니다. 이렇게 초기화 된 videostream.c와 은 각각의 메소드를 사용하고 원격 및 로컬 카메라 피드를 렌더링하는 서페이스를 제공합니다. 원격 포트 및 IP 주어진 비디오 스트림을 성공적으로 시작할 수 오전.

하지만 두 스트림을 함께 시작하면 문제가 발생합니다. 소리가 멈추고 비디오 스트리밍도 멈 춥니 다. 로컬 카메라 피드 만 작동합니다.

그래서 나는 나를 위해이 모든 일을하는 하나의 마법적인 방법을 가지고 있습니다. 내가 비디오 부분에 댓글을 달았다면. 오디오 통화가 잘 작동하고 오디오 부분에 댓글을 달면 화상 통화가 정상적으로 작동합니다. 하지만 둘 다 시작할 때. 스트리밍하지 않는 소리가 들리지 않습니다. 하지만 AudioStream이 성공적으로 시작되고 VideoStream이 성공적으로 로그를 시작합니다.

linphone 경험이있는 사람이 올바른 방법 순서를 찾는 데 도움이 될 수 있습니까? 또는 우리가 잘못하고있는 것. 여기에 우리의 방법이 있습니다.

JNIEXPORT jint JNICALL Java_com_myapp_services_LinPhoneMSEngine_LinPhoneMSVE_1AudioStreamStartFull 
(JNIEnv *env, jclass self, jstring remote_ip, jint remote_port, jint localport, jint payloadindex, jboolean isLowEnd) 
{ 
int bRetVal = 0; 
MSVideoSize size = {320, 240}; 
char rtcp_tool[128]={0}; 
int ret; 
//jboolean copy; 
char cname[128]={0}; 
const char *cremote_ip; 

ortp_warning("Audio Stream Start Full"); 
LOGD("Audio Stream Start Full"); 

cremote_ip = (*env)->GetStringUTFChars(env, remote_ip, NULL); 
ortp_warning("Cremote_ip= %s", cremote_ip); 
LOGD("Cremote_ip= %s", cremote_ip); 

// ms_filter_enable_statistics(TRUE); 

veData->queue = ortp_ev_queue_new(); 
veData->soundCard = NULL; 

set_playback_device(); 


ortp_warning("sound: playback_dev_id: %s", ms_snd_card_get_string_id(veData->soundCard)); 
LOGD("sound: playback_dev_id: %s", ms_snd_card_get_string_id(veData->soundCard)); 

veData->CaptureCard = NULL; 
set_capture_device(); 

ortp_warning("sound: capture_dev_id: %s", ms_snd_card_get_string_id(veData->CaptureCard)); 
LOGD("sound: capture_dev_id: %s", ms_snd_card_get_string_id(veData->CaptureCard)); 


veData->audioStream = audio_stream_new(msFactory ,localport, localport + 1, false); 

audio_stream_enable_adaptive_bitrate_control(veData->audioStream, true); 
audio_stream_enable_adaptive_jittcomp(veData->audioStream, true); 
rtp_session_set_jitter_compensation(veData->audioStream->ms.sessions.rtp_session, 50); 

rtp_session_enable_rtcp_mux(veData->audioStream->ms.sessions.rtp_session, true); 
ret=AUDIO_STREAM_FEATURE_VOL_SND | \ 
      AUDIO_STREAM_FEATURE_VOL_RCV; 

if (!isLowEnd) 
{ 
    ret = ret | AUDIO_STREAM_FEATURE_EC | AUDIO_STREAM_FEATURE_EQUALIZER | AUDIO_STREAM_FEATURE_DTMF | AUDIO_STREAM_FEATURE_DTMF_ECHO; 
    audio_stream_set_features(veData->audioStream, ret); 

    ortp_warning("Setting Echo Canceller params"); 
    LOGD("Setting Echo Canceller params"); 

    rtp_session_enable_jitter_buffer(veData->audioStream->ms.sessions.rtp_session, TRUE); 

    audio_stream_set_echo_canceller_params(veData->audioStream, 60, 0, 128); 

    audio_stream_enable_gain_control(veData->audioStream, true); 
    audio_stream_enable_automatic_gain_control(veData->audioStream, true); 

} 
else 
{ 
    audio_stream_set_features(veData->audioStream, ret); 

    ortp_warning("No Echo Canceller params!!"); 
    LOGD("No Echo Canceller params!!"); 
    rtp_session_enable_jitter_buffer(veData->audioStream->ms.sessions.rtp_session, FALSE); 

} 

if(veData->audioStream == NULL){ 
    ortp_warning("AudioStream is Null"); 
    LOGD("AudioStream is Null"); 
    bRetVal = -1; 
    return -1; 
} 

audio_stream_play_received_dtmfs(veData->audioStream, true); 


snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s","Android","2.8.0"); 

snprintf(cname,sizeof(cname)-1,"%s-%d", cremote_ip, remote_port); 
ortp_warning("cname value: %s",cname); 
LOGD("cname value: %s",cname); 
audio_stream_prepare_sound(veData->audioStream, veData->soundCard, veData->CaptureCard); 

if(0== audio_stream_start_full(veData->audioStream,veData->prof, cremote_ip, remote_port, cremote_ip, remote_port + 1, 114, 50,NULL,NULL,veData->soundCard,veData->CaptureCard, !isLowEnd)) 
{ 
    veData->rtpSession = veData->audioStream->ms.sessions.rtp_session; 
    ortp_warning("AudioStreamStartFull Success"); 
    post_audio_config(veData->audioStream); 
    audio_stream_set_rtcp_information(veData->audioStream, cname, rtcp_tool); 
} 
else 
{ 
    ortp_warning("AudioStream start failed"); 
    bRetVal = -1; 
} 

// init video stream 
veData->videoStream = video_stream_new(msFactory, localport,localport+1,false); 

video_stream_enable_adaptive_bitrate_control(veData->videoStream, true); 
video_stream_enable_adaptive_jittcomp(veData->videoStream, true); 
rtp_session_enable_rtcp_mux(veData->videoStream->ms.sessions.rtp_session, true); 

video_stream_use_video_preset(veData->videoStream, "custom"); 
video_stream_set_sent_video_size(veData->videoStream, size); 
video_stream_set_preview_size(veData->videoStream, size); 
video_stream_enable_self_view(veData->videoStream, TRUE); 

ortp_message("Video Stream : [%p] & native window id : [%p]",veData->videoStream, veData->native_window_id); 
video_stream_set_native_window_id(veData->videoStream, veData->native_window_id); 

ortp_message("Video Stream : [%p] & preview window id : [%p]",veData->videoStream, veData->native_preview_window_id); 
video_stream_set_native_preview_window_id(veData->videoStream, veData->native_preview_window_id); 

video_stream_use_preview_video_window(veData->videoStream, TRUE); 
video_stream_set_device_rotation(veData->videoStream, 0); 

video_stream_set_fps(veData->videoStream, 10.0); 

// link audio with video 
audio_stream_link_video(veData->audioStream, veData->videoStream); 

ms_message("Setting webcam as %p", veData->msWebCam); 
if(bRetVal != -1 && video_stream_start(veData->videoStream, veData->prof, 
         cremote_ip, 
         remote_port, 
         cremote_ip, 
         remote_port + 1, 
         101, 
         60, 
         veData->msWebCam) >=0) { 

    ortp_warning("VideoStream started successfully"); 
    veData->rtpSession = veData->videoStream->ms.sessions.rtp_session; 

    video_stream_set_rtcp_information(veData->videoStream, cname,rtcp_tool); 
} 
else 
{ 
    ortp_warning("VideoStream start failed"); 
    bRetVal = -1; 

} 

(*env)->ReleaseStringUTFChars(env, remote_ip, cremote_ip); 


return bRetVal; 
} 
+0

로그 파일도 제공 할 수 있습니다. – Javanator

답변

1

좋아, 마지막으로 @ belledonne-communications의 도움으로. 우리는 우리가 같은 항구에 양쪽 시내를 보내고 있다는 것을 알아 냈습니다.

불가능합니다. 그것은 다른 포트에서 보내야합니다. 우리는 그것을 바로 잡았고 효과가있었습니다.