For my book I wanted to see if there is a way to see the performance impact of various settings. So I launched the Energy Diagnostics instrument for the first time. I was not able to conclusively demonstrate the impact of any capture setting, but I did see something odd. Even though my barcode scanner sample app does not have any need for audio data AV Foundation appears to insist on capturing and processing it.

As the energy diagnostics performance instrument indicates, this causes energy usage for “Audio Processing” even though for the purpose of scanning barcodes audio is not needed. In the least developers should be able to indicate to iOS that they have no use for audio processing so that the system can conserve this energy.

BSA Banner

Summary

Apps which have no interest in capturing audio still incur energy waste for processing audio.

In my usage scenario (see sample) I am connecting the back-facing camera with a capture session and a metadata detector output for scanning barcodes. I have no interest in audio. Yet, in the Energy Diagnostics Instrument the “Audio Processing” bars hover around 20%.

From this I infer that Audio Processing is occurring even though it wouldn’t have to. There does not appear any way for a developer to indicate to iOS that audio should be ignored.

Steps to Reproduce

Open the provided sample app in Xcode

Profile it with the “Energy Diagnostics” Instrument

Expected Results

The Audio Processing (blue) portion of CPU Activity should be near 0%.

Actual Results

Audio Processing is around 20% on an iPhone 5S.

Notes

Please give information if this is intended behavior. Would it be a good enhancement to request to be able to instruct AV Foundation to ignore audio for barcode scanning scenarios like this?

I attached this screen shot showing the alleged energy waste. I provided the QRScanner app from my book as sample.