camera: NSLog fallback in photo delegate so we can see it fired
User reports macOS photo still rotated AND no `photo:` line in banlu.jsonl — so either the delegate isn't firing at all or the event-channel path is broken on the success branch. Add `NSLog` at the top of `photoOutput(_:didFinishProcessingPhoto:error:)` and on the CGImage path. NSLog lands in `flutter run` stderr + macOS Console regardless of channel state, so even if the diag event drops we'll see the delegate firing + the CGImage's dimensions. Once we see them we'll know whether it's a delegate problem or a channel problem.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import AVFoundation
|
import AVFoundation
|
||||||
import Foundation
|
import Foundation
|
||||||
import ImageIO
|
import ImageIO
|
||||||
|
import os.log
|
||||||
|
|
||||||
/// Wraps `AVCapturePhotoOutput`. One instance per
|
/// Wraps `AVCapturePhotoOutput`. One instance per
|
||||||
/// [CameraInstance]; gets added to the session at create time and
|
/// [CameraInstance]; gets added to the session at create time and
|
||||||
@@ -111,6 +112,13 @@ private final class PhotoCaptureDelegate: NSObject, AVCapturePhotoCaptureDelegat
|
|||||||
didFinishProcessingPhoto photo: AVCapturePhoto,
|
didFinishProcessingPhoto photo: AVCapturePhoto,
|
||||||
error: Error?
|
error: Error?
|
||||||
) {
|
) {
|
||||||
|
// Belt-and-suspenders logging: the event-channel `diag` is the
|
||||||
|
// primary path (lands in `banlu.jsonl` via ux.Log), but NSLog
|
||||||
|
// is a fallback that ALWAYS lands in `flutter run` stderr +
|
||||||
|
// macOS Console regardless of channel state. Helps confirm
|
||||||
|
// whether the delegate is even firing when the jsonl shows
|
||||||
|
// nothing.
|
||||||
|
NSLog("[ux.camera] photoOutput callback fired error=\(error?.localizedDescription ?? "none")")
|
||||||
if let error = error as NSError? {
|
if let error = error as NSError? {
|
||||||
diag("photo capture failed: domain=\(error.domain)"
|
diag("photo capture failed: domain=\(error.domain)"
|
||||||
+ " code=\(error.code) desc=\(error.localizedDescription)")
|
+ " code=\(error.code) desc=\(error.localizedDescription)")
|
||||||
@@ -140,6 +148,7 @@ private final class PhotoCaptureDelegate: NSObject, AVCapturePhotoCaptureDelegat
|
|||||||
)))
|
)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
NSLog("[ux.camera] cgImage: %dx%d", cgImage.width, cgImage.height)
|
||||||
diag("photo: \(cgImage.width)x\(cgImage.height) " +
|
diag("photo: \(cgImage.width)x\(cgImage.height) " +
|
||||||
"(cgImageRepresentation, no EXIF)")
|
"(cgImageRepresentation, no EXIF)")
|
||||||
let destination = CGImageDestinationCreateWithURL(
|
let destination = CGImageDestinationCreateWithURL(
|
||||||
|
|||||||
Reference in New Issue
Block a user