mediastreamer2_adaptive_tester.c: disable stateful tests for yet

parent 36213e70
/* /*
msosxdisplay.m msosxdisplay.m
Copyright (C) 2011 Belledonne Communications, Grenoble, France Copyright (C) 2011 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
...@@ -55,12 +55,12 @@ ...@@ -55,12 +55,12 @@
self->prevBounds = CGRectMake(0, 0, 0, 0); self->prevBounds = CGRectMake(0, 0, 0, 0);
self->lock = [[NSRecursiveLock alloc] init]; self->lock = [[NSRecursiveLock alloc] init];
self->display_helper = ogl_display_new(); self->display_helper = ogl_display_new();
[self setOpaque:YES]; [self setOpaque:YES];
[self setAsynchronous:NO]; [self setAsynchronous:NO];
[self setAutoresizingMask: kCALayerWidthSizable | kCALayerHeightSizable]; [self setAutoresizingMask: kCALayerWidthSizable | kCALayerHeightSizable];
[self setNeedsDisplayOnBoundsChange:YES]; [self setNeedsDisplayOnBoundsChange:YES];
// FBO Support // FBO Support
GLint numPixelFormats = 0; GLint numPixelFormats = 0;
CGLPixelFormatAttribute attributes[] = CGLPixelFormatAttribute attributes[] =
...@@ -70,19 +70,19 @@ ...@@ -70,19 +70,19 @@
kCGLPFADoubleBuffer, kCGLPFADoubleBuffer,
0 0
}; };
CGLChoosePixelFormat(attributes, &cglPixelFormat, &numPixelFormats); CGLChoosePixelFormat(attributes, &cglPixelFormat, &numPixelFormats);
assert(cglPixelFormat); assert(cglPixelFormat);
cglContext = [super copyCGLContextForPixelFormat:cglPixelFormat]; cglContext = [super copyCGLContextForPixelFormat:cglPixelFormat];
assert(cglContext); assert(cglContext);
CGLContextObj savedContext = CGLGetCurrentContext(); CGLContextObj savedContext = CGLGetCurrentContext();
CGLSetCurrentContext(cglContext); CGLSetCurrentContext(cglContext);
CGLLockContext(cglContext); CGLLockContext(cglContext);
ogl_display_init(display_helper, prevBounds.size.width, prevBounds.size.height); ogl_display_init(display_helper, prevBounds.size.width, prevBounds.size.height);
CGLUnlockContext(cglContext); CGLUnlockContext(cglContext);
CGLSetCurrentContext(savedContext); CGLSetCurrentContext(savedContext);
} }
...@@ -93,17 +93,17 @@ ...@@ -93,17 +93,17 @@
CGLContextObj savedContext = CGLGetCurrentContext(); CGLContextObj savedContext = CGLGetCurrentContext();
CGLSetCurrentContext(cglContext); CGLSetCurrentContext(cglContext);
CGLLockContext(cglContext); CGLLockContext(cglContext);
ogl_display_uninit(display_helper, TRUE); ogl_display_uninit(display_helper, TRUE);
ogl_display_free(display_helper); ogl_display_free(display_helper);
CGLUnlockContext(cglContext); CGLUnlockContext(cglContext);
CGLSetCurrentContext(savedContext); CGLSetCurrentContext(savedContext);
[self releaseCGLContext:cglContext]; [self releaseCGLContext:cglContext];
[self releaseCGLPixelFormat:cglPixelFormat]; [self releaseCGLPixelFormat:cglPixelFormat];
[lock release]; [lock release];
[super dealloc]; [super dealloc];
} }
...@@ -125,31 +125,31 @@ ...@@ -125,31 +125,31 @@
CGLReleaseContext(cglContext); CGLReleaseContext(cglContext);
} }
- (void)drawInCGLContext:(CGLContextObj)glContext - (void)drawInCGLContext:(CGLContextObj)glContext
pixelFormat:(CGLPixelFormatObj)pixelFormat pixelFormat:(CGLPixelFormatObj)pixelFormat
forLayerTime:(CFTimeInterval)timeInterval forLayerTime:(CFTimeInterval)timeInterval
displayTime:(const CVTimeStamp *)timeStamp { displayTime:(const CVTimeStamp *)timeStamp {
if([lock tryLock]) { if([lock tryLock]) {
CGLContextObj savedContext = CGLGetCurrentContext(); CGLContextObj savedContext = CGLGetCurrentContext();
CGLSetCurrentContext(cglContext); CGLSetCurrentContext(cglContext);
CGLLockContext(cglContext); CGLLockContext(cglContext);
if (!CGRectEqualToRect(prevBounds, [self bounds])) { if (!CGRectEqualToRect(prevBounds, [self bounds])) {
prevBounds = [self bounds]; prevBounds = [self bounds];
ogl_display_set_size(display_helper, prevBounds.size.width, prevBounds.size.height); ogl_display_set_size(display_helper, prevBounds.size.width, prevBounds.size.height);
} }
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
ogl_display_render(display_helper, 0); ogl_display_render(display_helper, 0);
CGLUnlockContext(cglContext); CGLUnlockContext(cglContext);
CGLSetCurrentContext(savedContext); CGLSetCurrentContext(savedContext);
CGLFlushDrawable(cglContext); CGLFlushDrawable(cglContext);
[super drawInCGLContext:glContext [super drawInCGLContext:glContext
pixelFormat:pixelFormat pixelFormat:pixelFormat
forLayerTime:timeInterval forLayerTime:timeInterval
displayTime:timeStamp]; displayTime:timeStamp];
[lock unlock]; [lock unlock];
} }
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
- (void)resetContainers { - (void)resetContainers {
[glLayer removeFromSuperlayer]; [glLayer removeFromSuperlayer];
if(window != nil) { if(window != nil) {
if(closeWindow) { if(closeWindow) {
[window close]; [window close];
...@@ -241,14 +241,14 @@ ...@@ -241,14 +241,14 @@
if(window == awindow) { if(window == awindow) {
return; return;
} }
[self resetContainers]; [self resetContainers];
if(awindow != nil) { if(awindow != nil) {
window = [awindow retain]; window = [awindow retain];
[glLayer setFrame:[[window.contentView layer] bounds]]; [glLayer setFrame:[[window.contentView layer] bounds]];
[[window.contentView layer] addSublayer: glLayer]; [[window.contentView layer] addSublayer: glLayer];
glLayer.sourceSize = CGSizeMake(0, 0); // Force window resize glLayer.sourceSize = CGSizeMake(0, 0); // Force window resize
} }
} }
...@@ -257,9 +257,9 @@ ...@@ -257,9 +257,9 @@
if(view == aview) { if(view == aview) {
return; return;
} }
[self resetContainers]; [self resetContainers];
if(aview != nil) { if(aview != nil) {
view = [aview retain]; view = [aview retain];
[view setWantsLayer:YES]; [view setWantsLayer:YES];
...@@ -272,9 +272,9 @@ ...@@ -272,9 +272,9 @@
if(layer == alayer) { if(layer == alayer) {
return; return;
} }
[self resetContainers]; [self resetContainers];
if(alayer != nil) { if(alayer != nil) {
layer = [alayer retain]; layer = [alayer retain];
[glLayer setFrame:[layer bounds]]; [glLayer setFrame:[layer bounds]];
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
CGFloat xPos = NSWidth([[awindow screen] frame])/2 - NSWidth([awindow frame])/2; CGFloat xPos = NSWidth([[awindow screen] frame])/2 - NSWidth([awindow frame])/2;
CGFloat yPos = NSHeight([[awindow screen] frame])/2 - NSHeight([awindow frame])/2; CGFloat yPos = NSHeight([[awindow screen] frame])/2 - NSHeight([awindow frame])/2;
[awindow setFrame:NSMakeRect(xPos, yPos, NSWidth([awindow frame]), NSHeight([awindow frame])) display:YES]; [awindow setFrame:NSMakeRect(xPos, yPos, NSWidth([awindow frame]), NSHeight([awindow frame])) display:YES];
// Init view // Init view
NSView *innerView = [[NSView alloc] initWithFrame:[window frame]]; NSView *innerView = [[NSView alloc] initWithFrame:[window frame]];
[innerView setWantsLayer:YES]; [innerView setWantsLayer:YES];
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
[innerView.layer setNeedsDisplayOnBoundsChange: YES]; [innerView.layer setNeedsDisplayOnBoundsChange: YES];
[awindow setContentView: innerView]; [awindow setContentView: innerView];
[innerView release]; [innerView release];
self.window = awindow; self.window = awindow;
self.closeWindow = TRUE; self.closeWindow = TRUE;
} }
...@@ -310,8 +310,9 @@ ...@@ -310,8 +310,9 @@
- (void)dealloc { - (void)dealloc {
[self resetContainers]; [self resetContainers];
[self.glLayer release];
self.glLayer = nil; self.glLayer = nil;
[super dealloc]; [super dealloc];
} }
...@@ -336,7 +337,7 @@ static void osx_gl_process(MSFilter* f) { ...@@ -336,7 +337,7 @@ static void osx_gl_process(MSFilter* f) {
OSXDisplay* thiz = (OSXDisplay*) f->data; OSXDisplay* thiz = (OSXDisplay*) f->data;
mblk_t* m = 0; mblk_t* m = 0;
MSPicture pic; MSPicture pic;
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
if ((m=ms_queue_peek_last(f->inputs[0])) != NULL) { if ((m=ms_queue_peek_last(f->inputs[0])) != NULL) {
...@@ -345,14 +346,14 @@ static void osx_gl_process(MSFilter* f) { ...@@ -345,14 +346,14 @@ static void osx_gl_process(MSFilter* f) {
// Source size change? // Source size change?
if (pic.w != thiz.glLayer.sourceSize.width || pic.h != thiz.glLayer.sourceSize.height) { if (pic.w != thiz.glLayer.sourceSize.width || pic.h != thiz.glLayer.sourceSize.height) {
thiz.glLayer.sourceSize = CGSizeMake(pic.w, pic.h); thiz.glLayer.sourceSize = CGSizeMake(pic.w, pic.h);
// Force window resize // Force window resize
if(thiz.window != nil) { if(thiz.window != nil) {
[thiz.glLayer performSelectorOnMainThread:@selector(resizeToWindow:) withObject:thiz.window waitUntilDone:FALSE]; [thiz.glLayer performSelectorOnMainThread:@selector(resizeToWindow:) withObject:thiz.window waitUntilDone:FALSE];
} }
} }
ogl_display_set_yuv_to_display(thiz.glLayer->display_helper, m); ogl_display_set_yuv_to_display(thiz.glLayer->display_helper, m);
// Force redraw // Force redraw
[thiz.glLayer performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:FALSE]; [thiz.glLayer performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:FALSE];
} }
...@@ -367,7 +368,7 @@ static void osx_gl_process(MSFilter* f) { ...@@ -367,7 +368,7 @@ static void osx_gl_process(MSFilter* f) {
if (thiz != nil) { if (thiz != nil) {
if (!mblk_get_precious_flag(m)) ms_yuv_buf_mirror(&pic); if (!mblk_get_precious_flag(m)) ms_yuv_buf_mirror(&pic);
ogl_display_set_preview_yuv_to_display(thiz.glLayer->display_helper, m); ogl_display_set_preview_yuv_to_display(thiz.glLayer->display_helper, m);
// Force redraw // Force redraw
[thiz.glLayer performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:FALSE]; [thiz.glLayer performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:FALSE];
} }
...@@ -396,7 +397,7 @@ static int osx_gl_set_vsize(MSFilter* f, void* arg) { ...@@ -396,7 +397,7 @@ static int osx_gl_set_vsize(MSFilter* f, void* arg) {
static int osx_gl_get_native_window_id(MSFilter* f, void* arg) { static int osx_gl_get_native_window_id(MSFilter* f, void* arg) {
OSXDisplay* thiz = (OSXDisplay*) f->data; OSXDisplay* thiz = (OSXDisplay*) f->data;
unsigned long *winId = (unsigned long*)arg; unsigned long *winId = (unsigned long*)arg;
int ret = -1; int ret = -1;
if(thiz != nil) { if(thiz != nil) {
if(thiz.window != nil) { if(thiz.window != nil) {
*winId = (unsigned long)thiz.window; *winId = (unsigned long)thiz.window;
...@@ -407,7 +408,7 @@ static int osx_gl_get_native_window_id(MSFilter* f, void* arg) { ...@@ -407,7 +408,7 @@ static int osx_gl_get_native_window_id(MSFilter* f, void* arg) {
} else if(thiz.layer != nil) { } else if(thiz.layer != nil) {
*winId = (unsigned long)thiz.layer; *winId = (unsigned long)thiz.layer;
ret = 0; ret = 0;
} else if(thiz.autoWindow) { } else if(thiz.autoWindow) {
*winId = MS_FILTER_VIDEO_AUTO; *winId = MS_FILTER_VIDEO_AUTO;
ret = 0; ret = 0;
} else { } else {
...@@ -422,7 +423,7 @@ static int osx_gl_set_native_window_id(MSFilter* f, void* arg) { ...@@ -422,7 +423,7 @@ static int osx_gl_set_native_window_id(MSFilter* f, void* arg) {
OSXDisplay* thiz = (OSXDisplay*) f->data; OSXDisplay* thiz = (OSXDisplay*) f->data;
unsigned long winId = *((unsigned long*)arg); unsigned long winId = *((unsigned long*)arg);
NSObject *obj = *((NSObject **)arg); NSObject *obj = *((NSObject **)arg);
int ret = -1; int ret = -1;
if(thiz != nil) { if(thiz != nil) {
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
if(winId != MS_FILTER_VIDEO_AUTO && winId != MS_FILTER_VIDEO_NONE) { if(winId != MS_FILTER_VIDEO_AUTO && winId != MS_FILTER_VIDEO_NONE) {
...@@ -441,7 +442,7 @@ static int osx_gl_set_native_window_id(MSFilter* f, void* arg) { ...@@ -441,7 +442,7 @@ static int osx_gl_set_native_window_id(MSFilter* f, void* arg) {
thiz.autoWindow = FALSE; thiz.autoWindow = FALSE;
} else { } else {
thiz.autoWindow = TRUE; thiz.autoWindow = TRUE;
} }
[thiz performSelectorOnMainThread:@selector(resetContainers) withObject:nil waitUntilDone:NO]; [thiz performSelectorOnMainThread:@selector(resetContainers) withObject:nil waitUntilDone:NO];
ret = 0; ret = 0;
} }
......
...@@ -444,7 +444,7 @@ static void upload_bitrate_opus_3g() { ...@@ -444,7 +444,7 @@ static void upload_bitrate_opus_3g() {
upload_bitrate("opus", OPUS_PAYLOAD_TYPE, THIRDGENERATION_BW, 200); upload_bitrate("opus", OPUS_PAYLOAD_TYPE, THIRDGENERATION_BW, 200);
} }
#if VIDEO_ENABLED #if VIDEO_ENABLED && 0
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) { 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"); bool_t supported = ms_filter_codec_supported("VP8");
if( supported ) { if( supported ) {
...@@ -486,7 +486,7 @@ static test_t tests[] = { ...@@ -486,7 +486,7 @@ static test_t tests[] = {
{ "Upload bitrate [opus] - edge", upload_bitrate_opus_edge }, { "Upload bitrate [opus] - edge", upload_bitrate_opus_edge },
{ "Upload bitrate [opus] - 3g", upload_bitrate_opus_3g }, { "Upload bitrate [opus] - 3g", upload_bitrate_opus_3g },
#if VIDEO_ENABLED #if VIDEO_ENABLED && 0
{ "Network detection [VP8] - ideal", adaptive_vp8_ideal }, { "Network detection [VP8] - ideal", adaptive_vp8_ideal },
{ "Network detection [VP8] - lossy", adaptive_vp8_lossy }, { "Network detection [VP8] - lossy", adaptive_vp8_lossy },
{ "Network detection [VP8] - congested", adaptive_vp8_congestion }, { "Network detection [VP8] - congested", adaptive_vp8_congestion },
......
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