-
Notifications
You must be signed in to change notification settings - Fork 2
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
NetSDR rate-test anomaly #7
Comments
Looking at the commit a60291a it was indeed meant to test the readfds, but somehow arguments got mixed up? |
Correcting that, rebuilding and running again, there is still no reported rate. And no calls to |
By just changing this function into: size_t SoapyNetSDR::getStreamMTU (SoapySDR::Stream *stream) const
{
return 1;
} the rate-test works:
But what does it really do? |
getStreamMTU is a hint for applications to be efficient. The rate tester app happens to use it
This MTU value of 0 should be replaced with however many samples per network packet are the default. |
Something like And I see my Afedri never sends UDP-packets bigger than 1444 on this LAN. |
That 1440+4 seems to be the magic number. The buffer in processUPD() looks wrong (but too big isn't a problem), it should be 4 (header) + 720 (elements) * 2 (element size). Just a guess though. MTU would be 720 then. Not too sure how big the elements are though. Did you see the many select() calls with the fix from above or without? Select on the UDP writefds would surely always return |
With. A |
Sorry, I meant the fix to select() on readfds, instead of writefds. That should be fixed too. |
I'd say we shouldn't even select() if (numElems <= datacount). It's a rare special case, but we should not impose a timeout on too small reads. |
Ah, selecting on readfds we will return with SOAPY_SDR_TIMEOUT for small reads ;) It just works now because select on writefds always comes back with 1. Basically the select is now just a no-op. Needs to be fixed but also skipped if there is still enough data in the datasave buffer. |
👍 |
Few thoughts
|
I'm on it but it might take a day or two. There are other piece perhaps wrong or at least obfuscated, e.g. |
Looks okay with |
The module currently respects the timeoutUs parameter and will block until a packet is available or timeoutUs is exceeded. |
Maybe it's an issue with |
Still some issue with a:
just hanging at the end forever. A opposed to a;
which returns after doing it's job, whatever that is. Shouldn't there be some |
I think I've found the issue.
Thus the last To fix it, I simply patched like so: --- a/NetSDR_Settings.cpp 2021-08-11 12:45:17
+++ b/NetSDR_Settings.cpp 2021-08-27 16:05:18
@@ -314,10 +314,11 @@
return false;
length -= 2; /* subtract header size */
-
- nbytes = recv(_tcp, (char *)&data[2], length, 0); /* read payload */
- if ( nbytes != length )
- return false;
+ if (length > 0) {
+ nbytes = recv(_tcp, (char *)&data[2], length, 0); /* read payload */
+ if ( nbytes != length )
+ return false;
+ }
rx_bytes = 2 + length; /* header + payload */
} |
Very nice, yes, recv with len 0 is not the right thing to do :) |
And BTW, the output of
Does this look OK? And the initial |
I'll try. |
Using this command to do a rate-test of my Afedri-SDR LAN receiver:
gives:
The report on the transfer rate is always
0 MBps
and no report on dropped packets or anything.Looking at the code in
NetSDR_Streaming.cpp
, the call to::select()
looks funny:Should it not test for a readable socket?
Tracing the rate-test, I off-course see a huge amount of calls to the above
::select()
.But the
::recvfrom()
never gets called!?I'm on Win-10 using a x86 version of Soapy.
The text was updated successfully, but these errors were encountered: