Ticket #1: fix forecast, reintroduce throttle. Whoo hoo!

git-svn-id: http://op25.osmocom.org/svn/trunk@176 65a5c917-d112-43f1-993d-58c26a4786be
This commit is contained in:
stevie 2009-09-10 05:59:25 +00:00
parent 72aea5299b
commit cd66608acf
2 changed files with 11 additions and 12 deletions

View File

@ -51,12 +51,17 @@ op25_decoder_ff::~op25_decoder_ff()
void
op25_decoder_ff::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
{
/* This block consumes 4800 symbols/s and produces 8000
* samples/s. That's a sampling rate of 3/5 or 0.6. If no output is
* available we'll produce silence so it should be ok to stick with
* this.
*/
const size_t nof_inputs = nof_input_items_reqd.size();
const int nof_samples_reqd = 3 * nof_output_items; // guesstimate to minimize audio under-runs
const int nof_samples_reqd = .6 * nof_output_items;
fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
}
int
int
op25_decoder_ff::general_work(int nof_output_items, gr_vector_int& nof_input_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items)
{
try {
@ -86,14 +91,11 @@ op25_decoder_ff::general_work(int nof_output_items, gr_vector_int& nof_input_ite
copy(samples->begin(), samples->begin() + n, out);
samples->erase(samples->begin(), samples->begin() + n);
}
#if 1
return n;
#else
if(n < nof_output_items) {
fill(out + n, out + nof_output_items, 0.0);
}
return nof_output_items;
#endif
} catch(const std::exception& x) {
cerr << x.what() << endl;
exit(1);

View File

@ -263,12 +263,9 @@ class p25_rx_block (stdgui2.std_top_block):
#
def __set_rx_from_file(self, filename, capture_rate):
file = gr.file_source(gr.sizeof_gr_complex, filename, True)
if 0:
throttle = gr.throttle(gr.sizeof_gr_complex, capture_rate)
self.__connect([[file, throttle]])
self.__build_graph(throttle, capture_rate)
else:
self.__build_graph(file, capture_rate)
throttle = gr.throttle(gr.sizeof_gr_complex, capture_rate)
self.__connect([[file, throttle]])
self.__build_graph(throttle, capture_rate)
# setup to rx from USRP
#