I think the answer is yes, but depends on your definition of affordability.
Median household income for city of LA is ~$60k. Without detailing the numbers, maybe if you're really liberal with mortgage qualification you get a $450k home at that income (house or condo). In a broad Redfin search of the Valley/LA Basin and a bit beyond to the east/south (this includes many cities outside of LA), you have:
Total homes for sale: 4,720
<$450k: 873 (18%)
In Safe Neighborhoods: 294 (6%) (I used my own definition of safe, but it's very liberal and includes many places where walking around after dark alone would not be advised, but it's an urban area after all so that's understandable)
Btw, and this is where people say you're not entitled to something, but if you are just talking about single family homes (LA is very single family home-focused) in a safe hood for <450k the number of availabilities drops to 51 homes (that's 1% of inventory).
Lots of other nuances here, but just a broad brushstroke look at the market.
I live in L.A. and as far as I'm concerned, yes they (we) are being priced out. You can live an hour away from your job or in a dangerous neighborhood, but that doesn't really mean the city is affordable.
It's just a pointless question to ask if middle class families can live in the city limits (an arbitrary border) in my opinion.
The better question is do middle class families have to live as far away from their jobs in LA as they do in SF, and the answer to that question is increasingly "yes."