summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.com>2013-05-01 16:53:11 (GMT)
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-05-11 16:28:59 (GMT)
commite024a3ca94b8ab8eb150d0c172e90c0b431b597c (patch)
tree446d022a8ee5b146f9d34b28b385d4faacde65fa
parent196b8fc388e2ebe12a88886ad4382ad8bdb03aba (diff)
downloadgst-plugins-bad-e024a3ca94b8ab8eb150d0c172e90c0b431b597c.tar.gz
gst-plugins-bad-e024a3ca94b8ab8eb150d0c172e90c0b431b597c.tar.xz
iosassetsrc: Retain the asset and assetrepresentation to keep them valid
It seems iOS cleans up the asset resources after the block ends. Need to explicitly inform it that ioassetsrc wants to keep them around for longer time
-rw-r--r--sys/applemedia/iosassetsrc.h1
-rw-r--r--sys/applemedia/iosassetsrc.m5
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/applemedia/iosassetsrc.h b/sys/applemedia/iosassetsrc.h
index e06ade2..b4c3f65 100644
--- a/sys/applemedia/iosassetsrc.h
+++ b/sys/applemedia/iosassetsrc.h
@@ -49,6 +49,7 @@ typedef struct _GstIOSAssetSrcClass GstIOSAssetSrcClass;
@interface GstAssetsLibrary : ALAssetsLibrary
{
+ ALAsset *asset;
ALAssetRepresentation *result;
}
diff --git a/sys/applemedia/iosassetsrc.m b/sys/applemedia/iosassetsrc.m
index 98ab185..da0a435 100644
--- a/sys/applemedia/iosassetsrc.m
+++ b/sys/applemedia/iosassetsrc.m
@@ -439,6 +439,8 @@ gst_ios_asset_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
- (void) release
{
+ [self->result release];
+ [self->asset release];
}
- (ALAssetRepresentation *) assetForURLSync:(NSURL*) uri
@@ -447,7 +449,8 @@ gst_ios_asset_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
- self->result = [myasset defaultRepresentation];
+ self->asset = [myasset retain];
+ self->result = [[myasset defaultRepresentation] retain];
dispatch_semaphore_signal(sema);
};