Skip to content

Potential issue #17

@grill2010

Description

@grill2010

Hi, I use the library in my streaming app and I encountered a potential issue, at some point very rarely my app was crashing so I started to investigating this problem and I found out it crashes here

https://github.com/Dario-Gasquez/swift-opus/blob/b763c399014eb6260a9bfe2f843677a4b4fd435b/Sources/Opus/Opus.Decoder.swift#L59

because the output variable was 'none' and the reason is that sample count returned 0 before ->

let sampleCount = opus_decoder_get_nb_samples(decoder, input.baseAddress!, Int32($0.count))

There was a pull request which added a check for this

#9 (review)

But this check should it not rather be

if sampleCount < 1 {
     throw Opus.Error(sampleCount)
}

as otherwise there will be a crash?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions