{"action":"created","issue":{"url":"https://api.github.com/repos/BradLarson/GPUImage/issues/2211","repository_url":"https://api.github.com/repos/BradLarson/GPUImage","labels_url":"https://api.github.com/repos/BradLarson/GPUImage/issues/2211/labels{/name}","comments_url":"https://api.github.com/repos/BradLarson/GPUImage/issues/2211/comments","events_url":"https://api.github.com/repos/BradLarson/GPUImage/issues/2211/events","html_url":"https://github.com/BradLarson/GPUImage/issues/2211","id":136633875,"number":2211,"title":"GPUImageUIElement – update outside of frameProcessingCompletionBlock","user":{"login":"gershengoren","id":13753490,"avatar_url":"https://avatars.githubusercontent.com/u/13753490?v=3","gravatar_id":"","url":"https://api.github.com/users/gershengoren","html_url":"https://github.com/gershengoren","followers_url":"https://api.github.com/users/gershengoren/followers","following_url":"https://api.github.com/users/gershengoren/following{/other_user}","gists_url":"https://api.github.com/users/gershengoren/gists{/gist_id}","starred_url":"https://api.github.com/users/gershengoren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gershengoren/subscriptions","organizations_url":"https://api.github.com/users/gershengoren/orgs","repos_url":"https://api.github.com/users/gershengoren/repos","events_url":"https://api.github.com/users/gershengoren/events{/privacy}","received_events_url":"https://api.github.com/users/gershengoren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-26T08:56:42Z","updated_at":"2016-03-16T02:50:28Z","closed_at":null,"body":"Hello,\r\n\r\nI have a `GPUImageBrightnessFilter`, a `GPUImageAlphaBlendFilter` with attached `GPUImageUIElement`. UIElement is initialized with UIView and has an UILabel inside. I'm trying to frequently update the text of this label and faced following strange behavior:\r\n\r\nWhen I use frameProcessingCompletionBlock and update the text inside – everything works fine.\r\n   ```\r\n   filter.frameProcessingCompletionBlock = { [weak self] filter, time in\r\n      if let strongSelf = self {\r\n        strongSelf.filter.useNextFrameForImageCapture()\r\n\r\n        // Update all labels\r\n        strongSelf.overlayTimeLabel.text = strongSelf.currentRoundTime\r\n        strongSelf.uiElementInput.updateUsingCurrentTime()\r\n      }\r\n      GPUImageContext.sharedFramebufferCache().purgeAllUnassignedFramebuffers()\r\n    }\r\n```\r\n`filter` is an instance of `GPUImageBrightnessFilter`\r\nBut when I try to change the `overlayTimeLabel.text` outside of this block, no changes will be displayed.\r\n\r\n```\r\n  func updateLabel() {\r\n    overlayTimeLabel.text = currentRoundTime\r\n  }\r\n```\r\nFunction `updateLabel` will be called each second.\r\n\r\nMy full setup:\r\n```\r\n  func setupFilters() {\r\n    filterView = self.view as! GPUImageView\r\n    filterView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill\r\n\r\n    filter = GPUImageBrightnessFilter()\r\n    blendFilter = GPUImageAlphaBlendFilter()\r\n    blendFilter.mix = 1.0\r\n\r\n    uiElementInput = GPUImageUIElement(view: createOverlayView())\r\n\r\n    filter.addTarget(blendFilter)\r\n    uiElementInput.addTarget(blendFilter)\r\n    blendFilter.addTarget(filterView)\r\n\r\n    filter.frameProcessingCompletionBlock = { [weak self] filter, time in\r\n      if let strongSelf = self {\r\n        strongSelf.filter.useNextFrameForImageCapture()\r\n\r\n        // Update all labels\r\n        strongSelf.overlayTimeLabel.text = strongSelf.currentRoundTime\r\n\r\n        strongSelf.uiElementInput.updateUsingCurrentTime()\r\n      }\r\n      GPUImageContext.sharedFramebufferCache().purgeAllUnassignedFramebuffers()\r\n    }\r\n  }\r\n\r\n\r\n  func prepareCamera() {\r\n    if camera != nil {\r\n      camera!.removeAllTargets()\r\n      camera = nil\r\n    }\r\n    camera = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPreset1280x720, cameraPosition: AVCaptureDevicePosition.Back)\r\n    camera!.outputImageOrientation = UIInterfaceOrientation.LandscapeRight\r\n    camera!.horizontallyMirrorFrontFacingCamera = false\r\n    camera!.horizontallyMirrorRearFacingCamera = false\r\n\r\n    if let output = camera!.captureSession.outputs.last as? AVCaptureVideoDataOutput {\r\n      let settings = output.videoSettings as NSDictionary\r\n      videoWidth = settings.objectForKey(\"Width\") as! Int\r\n      videoHeight = settings.objectForKey(\"Height\") as! Int\r\n    }\r\n    let videoSize = CGSize(width: videoWidth, height: videoHeight)\r\n\r\n    filter.forceProcessingAtSizeRespectingAspectRatio(videoSize)\r\n    blendFilter.forceProcessingAtSizeRespectingAspectRatio(videoSize)\r\n    uiElementInput.forceProcessingAtSizeRespectingAspectRatio(videoSize)\r\n\r\n    camera!.addTarget(filter)\r\n    camera!.startCameraCapture()\r\n  }\r\n```\r\n\r\nI'm wondering if it is a correct behavior?"},"comment":{"url":"https://api.github.com/repos/BradLarson/GPUImage/issues/comments/197126283","html_url":"https://github.com/BradLarson/GPUImage/issues/2211#issuecomment-197126283","issue_url":"https://api.github.com/repos/BradLarson/GPUImage/issues/2211","id":197126283,"user":{"login":"linjiansheng","id":5761899,"avatar_url":"https://avatars.githubusercontent.com/u/5761899?v=3","gravatar_id":"","url":"https://api.github.com/users/linjiansheng","html_url":"https://github.com/linjiansheng","followers_url":"https://api.github.com/users/linjiansheng/followers","following_url":"https://api.github.com/users/linjiansheng/following{/other_user}","gists_url":"https://api.github.com/users/linjiansheng/gists{/gist_id}","starred_url":"https://api.github.com/users/linjiansheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linjiansheng/subscriptions","organizations_url":"https://api.github.com/users/linjiansheng/orgs","repos_url":"https://api.github.com/users/linjiansheng/repos","events_url":"https://api.github.com/users/linjiansheng/events{/privacy}","received_events_url":"https://api.github.com/users/linjiansheng/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T02:50:28Z","updated_at":"2016-03-16T02:50:28Z","body":"I meet same problem if  update uiElementInput only when required"}}