                 
             }
         }
-        if totalLinks != 0 {
+        if totalLinks == 0 {
             NSLog("Does not look like an opus file.")
             
             throw OpusError.invalidState

//            print (packet.e_o_s)
        }
        
        //TODO: - check this is the right place to deallocate pcmDataBuffer
        pcmDataBuffer.deallocate(capacity: MemoryLayout<Float>.stride * Int(MAX_FRAME_SIZE) * Int(numChannels))
    }
    
    /// channels - used to __

    private var linkOut: Int32 = 0
    private var totalLinks: Int = 0
    private var numChannels: Int32 = 1
    var pcmDataBuffer = UnsafeMutablePointer<Float>.allocate(capacity: 0)
    var pcmData = Data()
    
    private var sampleRate = Int32(48000)
