mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
mac-capture: Fix possible division by zero error
Possibility of `mChannelsPerFrame` being 0 is not properly covered by current code, which will result in a division-by-zero error.
This commit is contained in:
parent
982c424de3
commit
f20f788d0b
|
@ -297,6 +297,13 @@ static inline void screen_stream_audio_update(struct screen_capture *sc,
|
||||||
CMAudioFormatDescriptionGetStreamBasicDescription(
|
CMAudioFormatDescriptionGetStreamBasicDescription(
|
||||||
format_description);
|
format_description);
|
||||||
|
|
||||||
|
if (audio_description->mChannelsPerFrame < 1) {
|
||||||
|
MACCAP_ERR(
|
||||||
|
"screen_stream_audio_update: Received sample buffer has less than 1 channel per frame (mChannelsPerFrame set to '%d')\n",
|
||||||
|
audio_description->mChannelsPerFrame);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char *_Nullable bytes = NULL;
|
char *_Nullable bytes = NULL;
|
||||||
CMBlockBufferRef data_buffer =
|
CMBlockBufferRef data_buffer =
|
||||||
CMSampleBufferGetDataBuffer(sample_buffer);
|
CMSampleBufferGetDataBuffer(sample_buffer);
|
||||||
|
|
Loading…
Reference in a new issue