Source

Target

Commits (5)
Showing with 64 additions and 25 deletions
......@@ -613,6 +613,9 @@ else()
if(APPLE)
list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds")
endif()
if(APPLE OR WIN32)
list(APPEND STRICT_OPTIONS_CPP "-Wno-shorten-64-to-32")
endif()
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "-Werror" "-Wextra" "-Wno-unused-parameter" "-fno-strict-aliasing" "-Wno-missing-field-initializers" "-Wno-error=deprecated-declarations")
endif()
......
......@@ -47,6 +47,10 @@ if(TURBOJPEG_INCLUDE_DIRS AND TURBOJPEG_LIBRARIES AND NOT MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${TURBOJPEG_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${TURBOJPEG_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error=unused-command-line-argument")
endif()
check_c_source_compiles("
#include <turbojpeg.h>
int main(int argc, char *argv[]) {
......
......@@ -51,7 +51,7 @@
* - Android capture: src/android/androidvideo.cpp
* - Android display: src/android/android-display.c
* - AV Foundation capture (iOS): src/videofilters/ioscapture.m
* - AV Foundation display (iOS): src/videofilters/iosdisplay.m
* - AV Foundation display (iOS): src/videofilters/iosdisplay.mm
* - DirectShow capture (Windows): src/videofilters/msdscap-mingw.cc
* - DrawDib display (Windows): src/videofilters/drawdib-display.c
* - External display - Send video to the upper layer: src/videofilters/extdisplay.c
......
......@@ -29,7 +29,6 @@
#define TS_REDGEN 2
#define TS_NUMBER_OF_OUTBUF TS_REDGEN + 1
#define TS_INBUF_SIZE TS_OUTBUF_SIZE * TS_NUMBER_OF_OUTBUF
#define TS_KEEP_ALIVE_INTERVAL 25000 //10000
#define TS_SEND_INTERVAL 299
#define MS_RTT_4103_SOURCE_SET_T140_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 0, int)
......@@ -37,6 +36,7 @@
#define MS_RTT_4103_SOURCE_SET_RED_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 1, int)
#define MS_RTT_4103_SINK_SET_RED_PAYLOAD_TYPE_NUMBER MS_FILTER_METHOD(MS_RTT_4103_SINK_ID, 1, int)
#define MS_RTT_4103_SOURCE_PUT_CHAR32 MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 2, uint32_t)
#define MS_RTT_4103_SOURCE_SET_KEEP_ALIVE_INTERVAL MS_FILTER_METHOD(MS_RTT_4103_SOURCE_ID, 3, unsigned int)
typedef struct _RealtimeTextReceivedCharacter {
uint32_t character;
......
......@@ -263,7 +263,7 @@ if(ENABLE_VIDEO)
voip/scaler.c
)
list(APPEND VOIP_SOURCE_FILES_OBJC
videofilters/iosdisplay.m
videofilters/iosdisplay.mm
videofilters/ioscapture.m
voip/ioshardware.m
)
......
......@@ -468,9 +468,9 @@ static void video_capture_detect(MSWebCamManager *obj){
}
char *idstring = bctbx_strdup_printf("%sFacingCamera%d", facing, c->id);
cam->id = ms_strdup(idstring);
bctbx_free(idstring);
ms_web_cam_manager_add_cam(obj,cam);
ms_message("camera created: id=%d frontFacing=%d orientation=%d [msid:%s]\n", c->id, c->frontFacing, c->orientation, idstring);
bctbx_free(idstring);
}
env->DeleteLocalRef(indexes);
env->DeleteLocalRef(frontFacing);
......
......@@ -29,6 +29,7 @@ typedef struct _RealTimeTextSourceData {
uint32_t timestamp[TS_NUMBER_OF_OUTBUF];
int pt_t140;
int pt_red;
unsigned int keepalive_interval;
} RealTimeTextSourceData;
static uint32_t get_prev_time(const RealTimeTextSourceData *stream) {
......@@ -167,7 +168,7 @@ static mblk_t* send_data(RealTimeTextSourceData *stream, uint32_t timestamp) {
use_next_buf(stream);
}
} else {
if (timestamp < prevtime || (timestamp - prevtime) > TS_KEEP_ALIVE_INTERVAL) {
if (timestamp < prevtime || (timestamp - prevtime) > stream->keepalive_interval) {
ms_rtt_4103_source_putchar32(stream, 0xFEFF); /* BOM */
ms_debug("Sending BOM");
return send_data(stream, timestamp);
......@@ -243,10 +244,22 @@ static int ms_rtt_4103_source_put_char32(MSFilter *f, void *character) {
return 0;
}
static int ms_rtt_4103_source_set_keep_alive_interval(MSFilter *f, void *interval) {
RealTimeTextSourceData *s = (RealTimeTextSourceData *)f->data;
ms_filter_lock(f);
s->keepalive_interval = *(unsigned int *)interval;
ms_debug("Keep alive interval is %i", s->keepalive_interval);
ms_filter_unlock(f);
return 0;
}
static MSFilterMethod ms_rtt_4103_source_methods[] = {
{ MS_RTT_4103_SOURCE_SET_T140_PAYLOAD_TYPE_NUMBER, ms_rtt_4103_source_set_t140_payload },
{ MS_RTT_4103_SOURCE_SET_RED_PAYLOAD_TYPE_NUMBER, ms_rtt_4103_source_set_red_payload },
{ MS_RTT_4103_SOURCE_PUT_CHAR32, ms_rtt_4103_source_put_char32 },
{ MS_RTT_4103_SOURCE_SET_KEEP_ALIVE_INTERVAL, ms_rtt_4103_source_set_keep_alive_interval},
{ 0, NULL }
};
......
......@@ -25,6 +25,10 @@
#include "opengl_functions.h"
#if defined __cplusplus
extern "C" {
#endif
struct opengles_display;
/**
......@@ -81,6 +85,10 @@ void ogl_display_render (struct opengles_display *gldisp, int deviceAngleFromPor
*/
void ogl_display_zoom (struct opengles_display *gldisp, float *params);
#if defined __cplusplus
};
#endif
#ifdef __ANDROID__
#include <jni.h>
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_display_OpenGLESDisplay_init (JNIEnv * env, jobject obj, jlong ptr, jint width, jint height);
......
/*
iosdisplay.m
iosdisplay.mm
Copyright (C) 2011 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
......@@ -29,6 +29,7 @@
#include "nowebcam.h"
#include "mediastreamer2/msfilter.h"
#include "scaler.h"
#include "bctoolbox/ios_utils.hh"
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
......@@ -130,8 +131,9 @@
}
- (void)drawView {
/* no opengl es call made when in background */
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive)
/* no opengl es call made when in background */
auto &iOSUtils = bctoolbox::IOSUtils::getUtils();
if (!iOSUtils.isApplicationStateActive())
return;
if([lock tryLock]) {
if(context == nil) {
......@@ -311,7 +313,7 @@ static int iosdisplay_set_zoom(MSFilter* f, void* arg) {
IOSDisplay* thiz = (IOSDisplay*)f->data;
if (!thiz)
return 0;
ogl_display_zoom(thiz->display_helper, arg);
ogl_display_zoom(thiz->display_helper, (float *) arg);
return 0;
}
......
......@@ -123,6 +123,13 @@ static void jpg_process(MSFilter *f) {
error = tjCompressFromYUVPlanes(
s->turboJpeg,
//This define has the purpose to support multiple versions of turboJPEG.
//The related value is set by the check_compile in the cmake/FindTurboJPEG.cmake
//Here we may have an "incompatible pointer type" build warning treated as an error (build with sanitizer)
//in the else block. If this is the case, check the CMakeError.log of TurboJPEG and ms2
#ifdef TURBOJPEG_USE_CONST_BUFFERS
(const unsigned char **)yuvbuf.planes,
#else
......
......@@ -287,28 +287,28 @@ H264ParameterSetsInserter::~H264ParameterSetsInserter() {
}
void H264ParameterSetsInserter::process(MSQueue *in, MSQueue *out) {
bool psBeforeIdr = false;
H264NaluHeader header;
bool isKeyFrame = false;
while (mblk_t *m = ms_queue_get(in)) {
MSH264NaluType type = ms_h264_nalu_get_type(m);
if (type == MSH264NaluTypeSPS) {
psBeforeIdr = true;
header.parse(m->b_rptr);
if (header.getType() == H264NaluType::Sps) {
replaceParameterSet(_sps, m);
} else if (type == MSH264NaluTypePPS) {
psBeforeIdr = true;
} else if (header.getType() == H264NaluType::Pps) {
replaceParameterSet(_pps, m);
} else {
if (_sps && _pps) {
if ((type == MSH264NaluTypeIDR || type == MSH264NaluTypeDataPartA) && !psBeforeIdr) {
ms_queue_put(out, dupmsg(_sps));
ms_queue_put(out, dupmsg(_pps));
}
ms_queue_put(out, m);
} else {
freemsg(m);
if (header.getType().isKeyFramePart()) {
ms_message("H264ParameterSetsInserter: I-frame detected");
isKeyFrame = true;
}
psBeforeIdr = false;
ms_queue_put(out, m);
}
}
if (isKeyFrame) {
mblk_t *insPoint = ms_queue_peek_first(out);
ms_queue_insert(out, insPoint, dupmsg(_sps));
ms_queue_insert(out, insPoint, dupmsg(_pps));
ms_message("H264ParameterSetsInserter: parameter sets inserted");
}
}
void H264ParameterSetsInserter::flush() {
......
......@@ -125,6 +125,7 @@ void H265ParameterSetsInserter::process(MSQueue *in, MSQueue *out) {
replaceParameterSet(_pps, m);
} else {
if (header.getType().isKeyFramePart()) {
ms_message("H265ParameterSetsInserter: I-frame detected");
isKeyFrame = true;
}
ms_queue_put(out, m);
......@@ -135,6 +136,7 @@ void H265ParameterSetsInserter::process(MSQueue *in, MSQueue *out) {
ms_queue_insert(out, insPoint, dupmsg(_vps));
ms_queue_insert(out, insPoint, dupmsg(_sps));
ms_queue_insert(out, insPoint, dupmsg(_pps));
ms_message("H265ParameterSetsInserter: parameter sets inserted");
}
}
......
......@@ -143,7 +143,7 @@ int main (int argc, char *argv[]) {
// this allows to launch tester from outside of tester directory
if (strstr(argv[0], ".libs")) {
long prefix_length =(long) (strstr(argv[0], ".libs") - argv[0] + 1);
char *prefix = ms_strdup_printf("%s%.*s", argv[0][0] == '/' ? "" : "./", prefix_length, argv[0]);
char *prefix = ms_strdup_printf("%s%.*s", argv[0][0] == '/' ? "" : "./", (int)prefix_length, argv[0]);
ms_warning("Resource prefix set to %s", prefix);
bc_tester_set_resource_dir_prefix(prefix);
bc_tester_set_writable_dir_prefix(prefix);
......