[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/12: Check RX/TX streamers::sptr before f
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/12: Check RX/TX streamers::sptr before flush/reset |
Date: |
Tue, 29 Dec 2015 22:49:22 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 4ae7a6015ba719a4720f61cc6f3857de2ebda89f
Author: Marcus Müller <address@hidden>
Date: Sun Aug 9 21:50:58 2015 +0200
Check RX/TX streamers::sptr before flush/reset
Current code triggers a segfault when user uses the stream arg setter
before starting the flowgraph.
Another surprising use case that segfaults is
tb->start();
usrp_source->stop();
which is a clever way to allow streaming to start when the user calls
usrp_source->issue_stream_cmd(...) rather than as soon as GNU Radio runs
without using set_start_time (e.g. when the start time is unknown at FG
initialization).
---
gr-uhd/lib/usrp_sink_impl.cc | 6 ++++--
gr-uhd/lib/usrp_source_impl.cc | 10 ++++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc
index 64d25bd..666f09c 100644
--- a/gr-uhd/lib/usrp_sink_impl.cc
+++ b/gr-uhd/lib/usrp_sink_impl.cc
@@ -321,7 +321,8 @@ namespace gr {
{
_update_stream_args(stream_args);
#ifdef GR_UHD_USE_STREAM_API
- _tx_stream.reset();
+ if(_tx_stream)
+ _tx_stream.reset();
#else
throw std::runtime_error("not implemented in this version");
#endif
@@ -609,7 +610,8 @@ namespace gr {
_nitems_to_send = 0;
#ifdef GR_UHD_USE_STREAM_API
- _tx_stream->send(gr_vector_const_void_star(_nchan), 0, _metadata, 1.0);
+ if(_tx_stream)
+ _tx_stream->send(gr_vector_const_void_star(_nchan), 0, _metadata, 1.0);
#else
_dev->get_device()->send
(gr_vector_const_void_star(_nchan), 0, _metadata,
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index e174e11..eeb9521 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -348,7 +348,8 @@ namespace gr {
{
_update_stream_args(stream_args);
#ifdef GR_UHD_USE_STREAM_API
- _rx_stream.reset();
+ if(_rx_stream)
+ _rx_stream.reset();
#else
throw std::runtime_error("not implemented in this version");
#endif
@@ -409,7 +410,12 @@ namespace gr {
while(true) {
#ifdef GR_UHD_USE_STREAM_API
const size_t bpi =
::uhd::convert::get_bytes_per_item(_stream_args.cpu_format);
- _rx_stream->recv(outputs, nbytes/bpi, _metadata, 0.0);
+ if(_rx_stream)
+ // get the remaining samples out of the buffers
+ _rx_stream->recv(outputs, nbytes/bpi, _metadata, 0.0);
+ else
+ // no rx streamer -- nothing to flush
+ break;
#else
_dev->get_device()->recv
(outputs, nbytes/_type->size, _metadata, *_type,
- [Commit-gnuradio] [gnuradio] branch master updated (b858d8f -> b17bcb8), git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 04/12: dtv: atsc: adds ControlPort interface to get equalizer taps., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 10/12: dtv: installing all examples, git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 12/12: Merge remote-tracking branch 'tom/dtv/atsc_controlport', git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 03/12: dtv: atsc: performance improvements for equalizer., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 11/12: Merge remote-tracking branch 'iohannez/gr_uhd_issue_stream_cmd_on_start', git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 06/12: dtv: atsc: adds ControlPort hooks to RS decoder., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 08/12: dtv: Adding a ControlPort client example for plotting the quality of an ATSC receiver., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 02/12: gr-uhd: add parameter to enable/disable streaming when flowgraph starts, git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 01/12: Check RX/TX streamers::sptr before flush/reset,
git <=
- [Commit-gnuradio] [gnuradio] 05/12: dtv: atsc: adds controlport hooks to equalizer., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 09/12: dtv: Cleanup; ATSC RS decoder - change log level to INFO instead of DEBUG., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 07/12: dtv: atsc: add ControlPort hooks into Viterbi decoder., git, 2015/12/29