adaptive tester: disable camera optimization when using no webcam

Conflicts:
	tester/mediastreamer2_adaptive_tester.c
	tester/mediastreamer2_tester.h
parent c1bdc7e5
......@@ -236,9 +236,9 @@ void start_adaptive_stream(MSFormatType type, stream_manager_t ** pmarielle, str
audio_manager_start(margaux,payload,marielle->local_rtp,0,NULL,recorded_file);
}else{
#if VIDEO_ENABLED
marielle->video_stream->staticimage_webcam_fps_optimization = FALSE;
video_manager_start(marielle,payload,margaux->local_rtp,0,marielle_webcam);
video_stream_set_direction(margaux->video_stream,VideoStreamRecvOnly);
video_manager_start(margaux,payload,marielle->local_rtp,0,NULL);
#else
ms_fatal("Unsupported stream type [%s]",ms_format_type_to_string(marielle->type));
......@@ -446,21 +446,14 @@ static void upload_bitrate_opus_3g() {
void adaptive_video(int max_bw, int exp_min_bw, int exp_max_bw, int loss_rate, int exp_min_loss, int exp_max_loss) {
bool_t supported = ms_filter_codec_supported("VP8");
if( supported ) {
bool_t has_cam = ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get())
!= ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "StaticImage: Static picture");
if (has_cam) {
stream_manager_t * marielle, * margaux;
start_adaptive_stream(MSVideo, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300*1000, max_bw*1000, loss_rate, 50,0);
iterate_adaptive_stream(marielle, margaux, 100000, &marielle->rtcp_count, 7);
CU_ASSERT_IN_RANGE(marielle->adaptive_stats.loss_estim, exp_min_loss, exp_max_loss);
CU_ASSERT_IN_RANGE(marielle->adaptive_stats.congestion_bw_estim, exp_min_bw, exp_max_bw);
stop_adaptive_stream(marielle,margaux);
} else {
/*ortp_loss_estimator rely on the fact that we receive some packets: however when
using static picture camera, there is a traffic of around 1 packet per second which
is totally unlikely leading in no QoS possibility*/
ms_warning("%s test disabled because no real camera is available", __FUNCTION__);
}
stream_manager_t * marielle, * margaux;
start_adaptive_stream(MSVideo, &marielle, &margaux, VP8_PAYLOAD_TYPE, 300*1000, max_bw*1000, loss_rate, 50,0);
iterate_adaptive_stream(marielle, margaux, 100000, &marielle->rtcp_count, 7);
CU_ASSERT_TRUE(marielle->adaptive_stats.loss_estim >= exp_min_loss);
CU_ASSERT_TRUE(marielle->adaptive_stats.loss_estim <= exp_max_loss);
CU_ASSERT_TRUE(marielle->adaptive_stats.congestion_bw_estim >= exp_min_bw);
CU_ASSERT_TRUE(marielle->adaptive_stats.congestion_bw_estim <= exp_max_bw);
stop_adaptive_stream(marielle,margaux);
}
}
......
......@@ -43,6 +43,12 @@ typedef struct {
} test_suite_t;
#include <mediastreamer2/mediastream.h>
#ifdef HAVE_CONFIG_H
#include "mediastreamer-config.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
......@@ -80,6 +86,7 @@ extern void mediastreamer2_tester_set_writable_dir(const char* writable_dir);
int apple_main(int argc, char *argv[]);
#endif
MSWebCam* mediastreamer2_tester_get_mir_webcam();
#ifdef __cplusplus
};
......
......@@ -32,28 +32,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static RtpProfile rtp_profile;
#define VP8_PAYLOAD_TYPE 103
#define H264_PAYLOAD_TYPE 104
#define MP4V_PAYLOAD_TYPE 105
MSWebCam* mediastreamer2_tester_get_mir_webcam() {
MSWebCam *cam;
#ifdef _MSC_VER
extern __declspec(dllimport) MSWebCamDesc mire_desc;
#else
extern MSWebCamDesc mire_desc;
#endif
cam = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "Mire: Mire (synthetic moving picture)");
if (cam == NULL) {
cam=ms_web_cam_new(&mire_desc);
ms_web_cam_manager_add_cam(ms_web_cam_manager_get(),cam);
}
#define VP8_PAYLOAD_TYPE 103
#define H264_PAYLOAD_TYPE 104
#define MP4V_PAYLOAD_TYPE 105
return cam;
}
static int tester_init(void) {
MSWebCam *cam;
ms_init();
ms_filter_enable_statistics(TRUE);
ortp_init();
rtp_profile_set_payload(&rtp_profile, VP8_PAYLOAD_TYPE, &payload_type_vp8);
rtp_profile_set_payload(&rtp_profile, H264_PAYLOAD_TYPE, &payload_type_h264);
rtp_profile_set_payload(&rtp_profile, MP4V_PAYLOAD_TYPE, &payload_type_mp4v);
cam=ms_web_cam_new(&mire_desc);
ms_web_cam_manager_add_cam(ms_web_cam_manager_get(),cam);
return 0;
}
......@@ -64,14 +73,6 @@ static int tester_cleanup(void) {
}
#ifdef VIDEO_ENABLED
/*#define MARIELLE_RTP_PORT 2564
#define MARIELLE_RTCP_PORT 2565
#define MARIELLE_IP "127.0.0.1"
#define MARGAUX_RTP_PORT 9864
#define MARGAUX_RTCP_PORT 9865
#define MARGAUX_IP "127.0.0.1"
*/
typedef struct _video_stream_tester_stats_t {
OrtpEvQueue *q;
......@@ -432,7 +433,7 @@ static void avpf_rpsi_count(void) {
marielle->vconf->fps=15;
marielle->vconf->vsize.height=MS_VIDEO_SIZE_CIF_H;
marielle->vconf->vsize.width=MS_VIDEO_SIZE_CIF_W;
marielle->cam = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "Mire: Mire (synthetic moving picture)");
marielle->cam = mediastreamer2_tester_get_mir_webcam();
margaux->vconf=ms_new0(MSVideoConfiguration,1);
......@@ -440,7 +441,7 @@ static void avpf_rpsi_count(void) {
margaux->vconf->fps=5; /*to save cpu resource*/
margaux->vconf->vsize.height=MS_VIDEO_SIZE_CIF_H;
margaux->vconf->vsize.width=MS_VIDEO_SIZE_CIF_W;
margaux->cam = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "Mire: Mire (synthetic moving picture)");
margaux->cam = mediastreamer2_tester_get_mir_webcam();
if (supported) {
init_video_streams(marielle, margaux, TRUE, FALSE, &params,VP8_PAYLOAD_TYPE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment