Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[apps] FIX srt-live-transmit stops listening after SRT disconnect #2997... #3108
base: master
Are you sure you want to change the base?
[apps] FIX srt-live-transmit stops listening after SRT disconnect #2997... #3108
Changes from 1 commit
dfa9a99
c9e9425
3289d96
33ffc41
726f66e
94cac83
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think that actually reading should be done this way: either you have the device read-ready, so you read, and then after you read, you don't know, and have to recheck.
Or, you can resolve to reading multiple times, counting on that when particular time reading isn't ready, then the Read call should report an error. Might be, I think, a good idea, to keep the "blocked" state in the fields, which will be written to, in case when particular Read implementation finds out that the call failed due to not being ready. This way it won't need to see if this is SRT and this way we use that function to get the error and maybe check for an SRT-specific readiness failure.
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.
From what I understand, the current implementation already follows this approach. For file descriptors in blocking mode (case 1), it checks if the device is ready before attempting to read, performs the read operation, and rechecks the state afterward since readiness isn’t guaranteed. For file descriptors in non-blocking mode (case 2), it handles multiple read attempts and relies on the error returned by the Read call to detect if the device isn’t ready.
Could you clarify if there’s something specific you’d like me to adjust or add to the current implementation? Perhaps there’s a particular scenario or behavior you’d like to address that isn’t currently handled?
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.
This here is unclear. First,
MayBlock()
actually represent the state whether setting the nonblocking mode could be done, which is useless. If the architecture requires nonblocking mode, it should be nonblocking always, and all devices should be operated as such. The case if operating the console device in blocking mode should not be even taken into account.The only thing I'm referring to is the approach to multiple reading calls, which should follow one of two methods:
Note that the second approach isn't possible to be used reliably in case of blocking mode, that's why it should not be taken into account.
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.
I understand the benefits of enforcing non-blocking mode for consistency and simplifying the architecture. However, I think it might be preferable to maintain support for both blocking and non-blocking modes. This flexibility ensures compatibility with a broader range of sources and use cases, particularly for systems where blocking mode is either required or more practical.
The current implementation can differentiate the handling of each mode:
• For blocking mode: Always check read-readiness before calling Read().
• For non-blocking mode: Check read-readiness once before the loop and perform multiple Read() calls until it’s no longer possible.
Would you be open to maintaining support for both modes, or do you see specific challenges in doing so?
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.
The initial specific about
srt-live-transmit
is that it is intended as a sample application, showing how to work with SRT using epoll and non-blocking mode. I don't think supporting the blocking mode was the case.Now the problem is that a user can actually set the blocking mode via URI
srt://ip:port?blocking=true
, and then the application must either work, or report an error that the blocking mode is not supported.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.
Exactly. This is built in into the architecture of this application to only support the nonblocking mode and it should not even take the blocking mode into account - unlike the
srt-test-live
application, which supports both, and it is prepared to work in either mode.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 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.
I don't feel good about this, because the
IsOpen()
function (BTW should be const) is supposed to check if the file is open. If the EOF functionality is needed, maybe better to useEnd()
function already defined below.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.
Actually the only use case when
cin.eof()
could be true is when a user presses Ctrl-D and when the pipeline is broken (you also need to ignore SIGPIPE).