I think your modified regexp is changing the header match from "boundary to double line endings" to "boundary to two lines terminated with line endings" so it is stopping after the second header line.
Consequently your next header is being included in the image content. One out and out hack you could do to get round this is on the buffer.Consume( subheader_len ) line below. If your extra headers are a fixed length always then just add that length, including any line end chars, to the subheader_len consumed, e.g. buffer.Consume( subheader_len + 37 )
Ok, I see the probem now, the old regexpr was counting on presense of empty line as the end of subheader. The new regexpr is only getting 2 lines of subheader...
It's based on fact that there must be upto 3 headers that all start with 'Content' and it also tries to make the last empty line optional (workaroudn for non-compliant E-tech). This works very well for my E-Tech Wi-Fi camera (I am getting a mjpeg stream with it right now), unfortunately since I don't have a camera compliant with mjpeg stream so I can't test the empty line at the end of the header.
If somebody could test it - that would be great! Another potential problem is that the 'Content' is case sensitive, I hope all cameras follow the case sensitivity as it's specified in the standard, if not then the RegExpr shoudl be changed from DAT_ALL (or whatever it is) to case insensitive.
I still have strange thing happening - exactly once a minute the 3rd line (and once in the logs I found that both 2nd and 3rd are skipped) of the header get's skipped and and I am getting 'not a jpeg file' complaining about Content-Auth getting in jpeg binary content...
Is there anything in thr system that might be happening every minute?
I dont see how this can be happening unless camera puts another 'suprise' in the stream every minute...
I'll try to do that at day time. I am more declinign to opinion that the problem is in somethign else because I have situation close to ideal at night time and almost no stable streaming during the day (however my camera is within 10 meters from the router...).