commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3983 - gnuradio/branches/developers/eb/rx-latency/gr-


From: eb
Subject: [Commit-gnuradio] r3983 - gnuradio/branches/developers/eb/rx-latency/gr-usrp/src
Date: Mon, 13 Nov 2006 23:50:45 -0700 (MST)

Author: eb
Date: 2006-11-13 23:50:45 -0700 (Mon, 13 Nov 2006)
New Revision: 3983

Modified:
   gnuradio/branches/developers/eb/rx-latency/gr-usrp/src/usrp1_source_base.cc
Log:
trial fix for excessive usrp rx latency

Modified: 
gnuradio/branches/developers/eb/rx-latency/gr-usrp/src/usrp1_source_base.cc
===================================================================
--- gnuradio/branches/developers/eb/rx-latency/gr-usrp/src/usrp1_source_base.cc 
2006-11-14 06:32:55 UTC (rev 3982)
+++ gnuradio/branches/developers/eb/rx-latency/gr-usrp/src/usrp1_source_base.cc 
2006-11-14 06:50:45 UTC (rev 3983)
@@ -29,7 +29,6 @@
 #include <usrp_standard.h>
 #include <assert.h>
 
-static const int OUTPUT_MULTIPLE_BYTES = 4 * 1024;
 
 usrp1_source_base::usrp1_source_base (const std::string &name,
                                      gr_io_signature_sptr output_signature,
@@ -58,9 +57,9 @@
     throw std::runtime_error ("can't open usrp1");
 
   // All calls to d_usrp->read must be multiples of 512 bytes.
-  // We jack this up to 4k to reduce overhead.
+  // We set this to match the fusb block size
 
-  set_output_multiple (OUTPUT_MULTIPLE_BYTES / 
output_signature->sizeof_stream_item (0));
+  set_output_multiple (d_usrp->block_size() / 
output_signature->sizeof_stream_item(0));
 }
 
 usrp1_source_base::~usrp1_source_base ()
@@ -91,13 +90,19 @@
                         gr_vector_const_void_star &input_items,
                         gr_vector_void_star &output_items)
 {
-  static const int BUFSIZE = 4 * OUTPUT_MULTIPLE_BYTES;
+  static const int BUFSIZE = 64 * 1024;
   unsigned char buf[BUFSIZE];
   int output_index = 0;
   int output_items_produced;
   int bytes_read;
   bool overrun;
 
+  // To minimize rx latency, never return more than 1 fusb block_size worth of 
samples.
+  // FIXME: A better fix would be to return the maximum we could without 
blocking,
+  // but the current interface doesn't allow us to do that.
+
+  noutput_items = std::max(output_multiple(), noutput_items);
+
   while (output_index < noutput_items){
     int nbytes = ninput_bytes_reqd_for_noutput_items (noutput_items - 
output_index);
     nbytes = std::min (nbytes, BUFSIZE);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]