-
Notifications
You must be signed in to change notification settings - Fork 126
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
fix PLI and FIR handling, wrongly triggering track.OnEnded #420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #420 +/- ##
==========================================
+ Coverage 47.23% 47.66% +0.42%
==========================================
Files 67 67
Lines 4456 4469 +13
==========================================
+ Hits 2105 2130 +25
+ Misses 2226 2212 -14
- Partials 125 127 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Is it possible to add a unit test? |
Sure, do you have any suggestion on how to implement this tests ? Making an RTCPReader mock ? |
I have implemented a unit test to check for good PLI and FIR detection. I have mocked the RTCPReader, which I think was the more easy and robust way to test this code. But the tradeoff is that the read buffer size bug would not have been detected with this test. Or at least not exactly the same bugs (the test requires a buffer size of 28 bytes minimum). I haven't found the official maximum packet size used by pion (I'm using the size used in tests and examples). So I don't want to add a test for this. By the way, it was necessary to add tests since the implementation was in fact not working at all. The Unmarshalling was not working but the error was ignored... I have fixed every now it should work as expected. |
Maximum packet size is limited by Ethernet frame size (1500 bytes). I think it's fine to use 1500 and consider jumbo frame later when requested. |
10d2c03
to
8501b27
Compare
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.
LGTM
Description
Fix the newly added PLI and FIR handling. An error has been introduce when merging the PR.
We were reading with an empty buffer, which lead to
io.ErrShortBuffer
error. This was causing the RTCP read loop to crash, but the track remained sending video, since the reading and writing loops were not linked.A potentially breaking side effect was also the call to
track.OnEnded
, while the track didn't realy ended in facts.I'm fixing this by using a buffer of 1500 bytes (from what I have found in different examples), and closing the track when read errors occurs.