JvanKatwijk / dab-cmdline

DAB decoding library with example of its use
GNU General Public License v2.0
57 stars 29 forks source link

Using fprintf instead of std:err to avoid lags #87

Closed vale-max closed 2 years ago

vale-max commented 2 years ago

Hello Jvan, I was experiencing a looong time between when the example-3 was started and when sound was actually heard when the program was started by the rtsp server and stdout and stderr were going to pipes.

The strange thing was that it paused several seconds after writing on stderr "try to start" and when the programName was actually written out. I suspected the issue was again with the streamer so I added some dumb log lines going to stderr in streamer.cpp and the problem was not showing anymore.

so I did some further test and, I've no idea why, using std:err to output messages was basically hanging everything for several seconds, writing the log lines from the streamed was evidently forcing the flush of some buffer. I removed the new log lines from the streamer and tried to add some std::endl and std::flush here and there but the problem was still there. Finally I changed the code to use fprintf and everything seems to work smoothly.

JvanKatwijk commented 2 years ago

Right now I am on the move, next week I'll handle it Best Jan

On Mon, Sep 12, 2022, 1:28 AM vale-max @.***> wrote:

Hello Jvan, I was experiencing a looong time between when the example-3 was started and when sound was actually heard when the program was started by the rtsp server and stdout and stderr were going to pipes.

The strange thing was that it paused several seconds after writing on stderr "try to start" and when the programName was actually written out. I suspected the issue was again with the streamer so I added some dumb log lines going to stderr in streamer.cpp and the problem was not showing anymore.

so I did some further test and, I've no idea why, using std:err to output messages was basically hanging everything for several seconds. Tried to add some std::endl and std::flush here and there but the problem was still there. Finally I changed the code to use fprintf and everything seems to work smoothly.

You can view, comment on, or merge this pull request online at:

https://github.com/JvanKatwijk/dab-cmdline/pull/87 Commit Summary

File Changes

(2 files https://github.com/JvanKatwijk/dab-cmdline/pull/87/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/dab-cmdline/pull/87, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQDAMS2NAOMQQMNSN5TV5ZTLVANCNFSM6AAAAAAQJ7OECQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JvanKatwijk commented 2 years ago

done