lSampleSize is a AM_MEDIA_TYPE member, which (as far as I can see) isn't relevant to this function.
AM_MEDIA_TYPE or the synonymous WM_MEDIA_TYPE; I was referring to the type set on the stream in question.
I gather the application is confused by the size, not capacity, in which case, yes, we should be clamping to native's size, but I'm not sure that's what Matteo meant.