-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround for file://con use of stdin on Windows #651
base: master
Are you sure you want to change the base?
Conversation
…stdin-experiment1 Workaround for file://con use of stdin on Windows
…stdin-test-2 Dnastrain/srt live transmit fix stdin test 2
@dnastrain Cool! This works! Funny thing is that
This is a kind of a fragile part for further maintenance. This thing is probably not related to this PR, but found it while testing your fix. Like as you wrote:
This set up:
Detects connection (prints Accepted SRT target connection). But does not detect disconnection, and does not initialize new listening for incomming connections, so you can not connect again. But this seems to be true for the current master version.
Prints neither Source SRT connected, nor Source SRT disconnected. |
@maxlovic, ok, great! Btw, I agree with you re: that one code part is kind of fragile, and is also what allowed the change to be small+targeted, since as you said it was:
I had also noticed that current master has the same behavior, re:
That said, when I use cmd-lines listed in #646 , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue detecting target caller loosing SRT connection.
Interrupt receiver-listener with Ctrl+C.
Listener (Ctrl + C)
srt-live-transmit.exe srt://:4200 file://con -v
Media path: 'srt://:4200' --> 'file://con'
Opening SRT source listener on :4200
Binding a server on :4200 ...
listen...
accept...
connected.
Accepted SRT source connection
-------- REQUESTED INTERRUPT!
Check the output of the caller-sender (current master). It detects disconnection: SRT target disconnected
.
Caller (master version)
srt-live-transmit.exe file://con srt://127.0.0.1:4200 -v
Media path: 'file://con' --> 'srt://127.0.0.1:4200'
Opening SRT target caller on 127.0.0.1:4200
Connecting to 127.0.0.1:4200
SRT target connected
SRT target disconnected
SrtCommon: DESTROYING CONNECTION, closing sockets (rt%64882620 ls%-1)...
SrtCommon: ... done.
Opening SRT target
-------- REQUESTED INTERRUPT!
Check the output of the caller-sender (current PR). It does not detect disconnection.
Caller (PR 651)
srt-live-transmit.exe file://con srt://127.0.0.1:4200 -v
Media path: 'file://con' --> 'srt://127.0.0.1:4200'
Opening SRT target caller on 127.0.0.1:4200
Connecting to 127.0.0.1:4200
SRT target connected
Thank you @maxlovic for those details! |
I just quickly checked it yesterday to check if this PR is ready to be merged. But it appered to introduce this issue with detecting target disconnection. I believe there were no fixes in SRT master branch since. But maybe worth updating. |
Hi @maxlovic, I agree the current code does have that side affect -- if I comment out the lines
The behavior goes away (or better, matches Master). |
@dnastrain For some reason
|
Hi @maxlovic , thank you for that info! (I think this also explains why when I tested with ffmpeg piping data into |
@dnastrain I've updated your code like this to check what is happening:
Funny thing is that when I stick the terminal window to the left side of the window, with Win + Left, or any other key press, I get the event. And the event has to be read with Also this condition is bad without checking |
It does now seem that one of your original suggestions for issue #646 , finding a 'non-blocking' version |
Hi @maxlovic, so I agree the version in my PR is not 'issue free', since it can fail to detect a disconnect event if the cin.read() call is active and blocking. At this point I would suggest this is as a 'lesser-issue' than the original problem in #646 , where Thoughts? |
btw, I did some experiments with using some forums on stackoverflow suggest calling I would still contend that this PR works correctly when data is streaming into |
This is not a critical issue, and it is a sample application issue, so better to come up with a proper fix. |
Workaround of issue found on Windows when using "file://con" for input to
srt-live-transmit.exe
-- only 1st 13160 bytes of data was being read fromstdin
.Proposed fix for issue #646