-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
read a complete frame every time when use rtspovertcp #126
Conversation
cfcba7f
to
b7f4e27
Compare
b7f4e27
to
9ed5970
Compare
@bailb Thanks for your contributions, judging from the current logic, if the length is still not satisfied after an additional read of data, the entire RtspServerSession process will exit. Have you ever encountered this situation? If that is the case, can this problem be solved by replacing if with while?
|
yes, I really encountered this error. and I solved the problem with a loop before. just think it's better use a function with timeout. |
.io | ||
.lock() | ||
.await | ||
.read_min_bytes_with_timeout(Duration::from_millis(1000), a.length.into()) |
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 length parameter passed into the function maybe a.length - self.reader.len() ??
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.
ping @bailb
From your perspective, why it is better to use timeout? |
under rtspovertcp mode. the length of frame is after the '$', and the content is after that. but the previous logic after decoding the length field just read from socket only once, so it's very frequency to occur that the length we decoded not match the real length we read.