The answer is not the code, that works, but it's the CODECs. If I stream using my tool in audio AAC, that doesn't work. If I stream my desktop (that's what the application does) in x264, that doesn't work either.
If I stream audio in mp3, the file grows.
Unfortunately, the tool doesn't stream video in another codec, so I can't be sure that video is saved, but I assume so.