Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed report_memory due to complaints that it conflicted with other…

… libraries. Fixed a memory leak in GPUImageRawDataOutput.
  • Loading branch information...
commit 202ce483fcc474a60d358bd068317a415de93f86 1 parent bc1c59a
@BradLarson BradLarson authored
View
2  framework/Source/GPUImageOutput.h
@@ -4,7 +4,7 @@
void runOnMainQueueWithoutDeadlocking(void (^block)(void));
void runSynchronouslyOnVideoProcessingQueue(void (^block)(void));
-void report_memory(NSString *tag);
+void reportAvailableMemoryForGPUImage(NSString *tag);
@class GPUImageMovieWriter;
View
2  framework/Source/GPUImageOutput.m
@@ -29,7 +29,7 @@ void runSynchronouslyOnVideoProcessingQueue(void (^block)(void))
}
}
-void report_memory(NSString *tag)
+void reportAvailableMemoryForGPUImage(NSString *tag)
{
if (!tag)
tag = @"Default";
View
1  framework/Source/GPUImageRawDataOutput.h
@@ -17,6 +17,7 @@ typedef struct GPUByteColorVector GPUByteColorVector;
CVPixelBufferRef renderTarget;
GPUImageRotationMode inputRotation;
BOOL outputBGRA;
+ CVOpenGLESTextureRef renderTexture;
}
@property(readonly) GLubyte *rawBytesForImage;
View
7 framework/Source/GPUImageRawDataOutput.m
@@ -154,7 +154,6 @@ - (void)createDataFBO;
attrs,
&renderTarget);
- CVOpenGLESTextureRef renderTexture;
CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
rawDataTextureCache, renderTarget,
NULL, // texture attributes
@@ -192,6 +191,12 @@ - (void)destroyDataFBO;
{
[GPUImageOpenGLESContext useImageProcessingContext];
+ if (renderTexture)
+ {
+ CFRelease(renderTexture);
+ renderTexture = NULL;
+ }
+
if (dataFramebuffer)
{
glDeleteFramebuffers(1, &dataFramebuffer);
View
12 framework/Source/GPUImageStillCamera.m
@@ -145,11 +145,11 @@ - (void)capturePhotoAsImageProcessedUpToFilter:(GPUImageOutput<GPUImageInput> *)
- (void)capturePhotoAsJPEGProcessedUpToFilter:(GPUImageOutput<GPUImageInput> *)finalFilterInChain withCompletionHandler:(void (^)(NSData *processedJPEG, NSError *error))block;
{
-// report_memory(@"Before still image capture");
+// reportAvailableMemoryForGPUImage(@"Before still image capture");
dispatch_semaphore_wait(frameRenderingSemaphore, DISPATCH_TIME_FOREVER);
[photoOutput captureStillImageAsynchronouslyFromConnection:[[photoOutput connections] objectAtIndex:0] completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
-// report_memory(@"Before filter processing");
+// reportAvailableMemoryForGPUImage(@"Before filter processing");
// For now, resize photos to fix within the max texture size of the GPU
CVImageBufferRef cameraFrame = CMSampleBufferGetImageBuffer(imageSampleBuffer);
@@ -179,20 +179,20 @@ - (void)capturePhotoAsJPEGProcessedUpToFilter:(GPUImageOutput<GPUImageInput> *)f
}
}
-// report_memory(@"After filter processing");
+// reportAvailableMemoryForGPUImage(@"After filter processing");
__strong NSData *dataForJPEGFile = nil;
@autoreleasepool {
UIImage *filteredPhoto = [finalFilterInChain imageFromCurrentlyProcessedOutput];
dispatch_semaphore_signal(frameRenderingSemaphore);
-// report_memory(@"After UIImage generation");
+// reportAvailableMemoryForGPUImage(@"After UIImage generation");
dataForJPEGFile = UIImageJPEGRepresentation(filteredPhoto, 0.8);
-// report_memory(@"After JPEG generation");
+// reportAvailableMemoryForGPUImage(@"After JPEG generation");
}
-// report_memory(@"After autorelease pool");
+// reportAvailableMemoryForGPUImage(@"After autorelease pool");
block(dataForJPEGFile, error);
}];
Please sign in to comment.
Something went wrong with that request. Please try again.