Fix unused variable warnings
Remove some unused variables and add unused attribute to other variables PiperOrigin-RevId: 481706551
This commit is contained in:
parent
f6c2f86086
commit
5e543c506f
|
@ -244,7 +244,7 @@
|
||||||
if ([_session canAddOutput:_depthDataOutput]) {
|
if ([_session canAddOutput:_depthDataOutput]) {
|
||||||
[_session addOutput:_depthDataOutput];
|
[_session addOutput:_depthDataOutput];
|
||||||
|
|
||||||
AVCaptureConnection* connection =
|
AVCaptureConnection* __unused connection =
|
||||||
[_depthDataOutput connectionWithMediaType:AVMediaTypeDepthData];
|
[_depthDataOutput connectionWithMediaType:AVMediaTypeDepthData];
|
||||||
|
|
||||||
// Set this when we have a handler.
|
// Set this when we have a handler.
|
||||||
|
@ -327,7 +327,6 @@
|
||||||
if (depthData.depthDataType != kCVPixelFormatType_DepthFloat32) {
|
if (depthData.depthDataType != kCVPixelFormatType_DepthFloat32) {
|
||||||
depthData = [depthData depthDataByConvertingToDepthDataType:kCVPixelFormatType_DepthFloat32];
|
depthData = [depthData depthDataByConvertingToDepthDataType:kCVPixelFormatType_DepthFloat32];
|
||||||
}
|
}
|
||||||
CVPixelBufferRef depthBuffer = depthData.depthDataMap;
|
|
||||||
[self.delegate processDepthData:depthData timestamp:timestamp fromSource:self];
|
[self.delegate processDepthData:depthData timestamp:timestamp fromSource:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,12 @@ void CallFrameDelegate(void* wrapperVoid, const std::string& streamName,
|
||||||
if (format == mediapipe::ImageFormat::SRGBA) {
|
if (format == mediapipe::ImageFormat::SRGBA) {
|
||||||
// Swap R and B channels.
|
// Swap R and B channels.
|
||||||
const uint8_t permuteMap[4] = {2, 1, 0, 3};
|
const uint8_t permuteMap[4] = {2, 1, 0, 3};
|
||||||
vImage_Error vError = vImagePermuteChannels_ARGB8888(
|
vImage_Error __unused vError =
|
||||||
&vSource, &vDestination, permuteMap, kvImageNoFlags);
|
vImagePermuteChannels_ARGB8888(&vSource, &vDestination, permuteMap, kvImageNoFlags);
|
||||||
_GTMDevAssert(vError == kvImageNoError, @"vImagePermuteChannels failed: %zd", vError);
|
_GTMDevAssert(vError == kvImageNoError, @"vImagePermuteChannels failed: %zd", vError);
|
||||||
} else {
|
} else {
|
||||||
// Convert grayscale back to BGRA
|
// Convert grayscale back to BGRA
|
||||||
vImage_Error vError = vImageGrayToBGRA(&vSource, &vDestination);
|
vImage_Error __unused vError = vImageGrayToBGRA(&vSource, &vDestination);
|
||||||
_GTMDevAssert(vError == kvImageNoError, @"vImageGrayToBGRA failed: %zd", vError);
|
_GTMDevAssert(vError == kvImageNoError, @"vImageGrayToBGRA failed: %zd", vError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,11 @@ static UIImage* UIImageWithPixelBuffer(CVPixelBufferRef pixelBuffer) {
|
||||||
static void EnsureOutputDirFor(NSString *outputFile) {
|
static void EnsureOutputDirFor(NSString *outputFile) {
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
BOOL result = [fileManager createDirectoryAtPath:[outputFile stringByDeletingLastPathComponent]
|
BOOL __unused result =
|
||||||
withIntermediateDirectories:YES
|
[fileManager createDirectoryAtPath:[outputFile stringByDeletingLastPathComponent]
|
||||||
attributes:nil
|
withIntermediateDirectories:YES
|
||||||
error:&error];
|
attributes:nil
|
||||||
|
error:&error];
|
||||||
// TODO: Log the error for clarity. The file-write will fail later
|
// TODO: Log the error for clarity. The file-write will fail later
|
||||||
// but it would be nice to see this error. However, 'error' is still testing
|
// but it would be nice to see this error. However, 'error' is still testing
|
||||||
// false and result is true even on an unwritable path-- not sure what's up.
|
// false and result is true even on an unwritable path-- not sure what's up.
|
||||||
|
@ -89,17 +90,10 @@ static void EnsureOutputDirFor(NSString *outputFile) {
|
||||||
__block CVPixelBufferRef output;
|
__block CVPixelBufferRef output;
|
||||||
graph.delegate = self;
|
graph.delegate = self;
|
||||||
|
|
||||||
// The XCTAssert macros contain references to self, which causes a retain cycle,
|
|
||||||
// since the block retains self and self retains the block. The cycle is broken
|
|
||||||
// at the end of this method, with _pixelBufferOutputBlock = nil, but Clang does
|
|
||||||
// not realize that and outputs a warning. WEAKIFY and STRONGIFY, though not
|
|
||||||
// strictly necessary, are used here to avoid the warning.
|
|
||||||
WEAKIFY(self);
|
|
||||||
if (!_pixelBufferOutputBlock) {
|
if (!_pixelBufferOutputBlock) {
|
||||||
XCTestExpectation* outputReceived = [self expectationWithDescription:@"output received"];
|
XCTestExpectation* outputReceived = [self expectationWithDescription:@"output received"];
|
||||||
_pixelBufferOutputBlock = ^(MPPGraph* outputGraph, CVPixelBufferRef outputBuffer,
|
_pixelBufferOutputBlock = ^(MPPGraph* outputGraph, CVPixelBufferRef outputBuffer,
|
||||||
const std::string& outputStreamName) {
|
const std::string& outputStreamName) {
|
||||||
STRONGIFY(self);
|
|
||||||
XCTAssertEqualObjects(outputGraph, graph);
|
XCTAssertEqualObjects(outputGraph, graph);
|
||||||
XCTAssertEqual(outputStreamName, outputStream);
|
XCTAssertEqual(outputStreamName, outputStream);
|
||||||
CFRetain(outputBuffer);
|
CFRetain(outputBuffer);
|
||||||
|
|
|
@ -287,9 +287,7 @@ REGISTER_CALCULATOR(ErrorCalculator);
|
||||||
CFHolder<CVPixelBufferRef> inputBuffer;
|
CFHolder<CVPixelBufferRef> inputBuffer;
|
||||||
absl::Status status = CreateCVPixelBufferFromCGImage(_sourceImage.CGImage, &inputBuffer);
|
absl::Status status = CreateCVPixelBufferFromCGImage(_sourceImage.CGImage, &inputBuffer);
|
||||||
XCTAssert(status.ok());
|
XCTAssert(status.ok());
|
||||||
CVPixelBufferRef outputBuffer = [self runGraph:_graph
|
[self runGraph:_graph withPixelBuffer:*inputBuffer packetType:MPPPacketTypePixelBuffer];
|
||||||
withPixelBuffer:*inputBuffer
|
|
||||||
packetType:MPPPacketTypePixelBuffer];
|
|
||||||
__weak MPPGraph* weakGraph = _graph;
|
__weak MPPGraph* weakGraph = _graph;
|
||||||
_graph = nil;
|
_graph = nil;
|
||||||
XCTAssertNil(weakGraph);
|
XCTAssertNil(weakGraph);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user