[vlc-devel] [PATCH] Made VLCMedia load all URLs; made VLCOpenGLVoutView ignore -reshape requests when quit is in progress, thus avoiding a segfault.

Pierre d'Herbemont pdherbemont at free.fr
Thu May 14 18:33:34 CEST 2009


On Thu, May 14, 2009 at 3:46 AM, Malte Tancred <malte at frontbase.com> wrote:
> (resending this patch to the list as I wasn't subscribed when I sent it
> yesterday)
>
> VLCMedia used only the trailing path part of the URL it was handed. I
> changed the roles if initWithPath: and initWithURL: by letting initWithPath:
> create an NSURL. With this change I'm able to play network streams.
>
> The changes to VLCOpenGLVoutView was made to avoid a segfault in
> objc_msgSend that occurred as a side-effect of sending -removeFromSuperview
> to the VLCVideoView. This patch might just be treating symptoms, but it
> didn't seem right go through with all the code in -reshape if we're in the
> process of closing down. The segfault happened on the first line of
> cocoaglvoutviewLock() in VLCOpenGLVoutView.m, where I guess either
> p_vout->p_sys->o_glview or its -openGLContext pointed to something bad. I'm
> not sure checking p_vout->b_die is the right way to go either.
> ---
> modules/gui/minimal_macosx/VLCOpenGLVoutView.m |    9 ++++++++-
> projects/macosx/framework/Sources/VLCMedia.m   |    8 ++++----
> 2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
> b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
> index bb3b1c5..878ecfb 100644
> --- a/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
> +++ b/modules/gui/minimal_macosx/VLCOpenGLVoutView.m
> @@ -96,9 +96,10 @@ void cocoaglvoutviewEnd( vout_thread_t * p_vout )
>        [o_cocoaglview_container removeVoutSubview: p_vout->p_sys->o_glview];
>
>    [p_vout->p_sys->o_glview release];
> +    p_vout->p_sys->o_glview = nil;
>
>    [p_vout->p_sys->o_pool release];
> -
> +    p_vout->p_sys->o_pool = nil;
> }
>
> /*****************************************************************************
> @@ -305,6 +306,12 @@ void cocoaglvoutviewUnlock( vout_thread_t * p_vout )
>        return;
>    }
>
> +    if( p_vout->b_die )
> +    {
> +        [objectLock unlock];
> +        return;
> +    }
> +
>    cocoaglvoutviewLock( p_vout );
>    NSRect bounds = [self bounds];

Sounds ok.

> diff --git a/projects/macosx/framework/Sources/VLCMedia.m
> b/projects/macosx/framework/Sources/VLCMedia.m
> index 3756178..a55a042 100644
> --- a/projects/macosx/framework/Sources/VLCMedia.m
> +++ b/projects/macosx/framework/Sources/VLCMedia.m
> @@ -168,12 +168,12 @@ static void HandleMediaSubItemAdded(const
> libvlc_event_t * event, void * self)
>    return [[[VLCMedia alloc] initAsNodeWithName:aName] autorelease];
> }
>
> -- (id)initWithURL:(NSURL *)anURL
> +- (id)initWithPath:(NSString *)aPath

You can add initWithURL, but could you keep it withPath as well?
Anyway, that's a separate patch.

Pierre.



More information about the vlc-devel mailing list