# Is a bug about stream\_mux block?

**URL:** <https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047>\
**Category:** GNU Radio\
**Created:** [March 25, 2014, 4:40pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047 "2014-03-25T16:40:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [March 25, 2014, 4:40pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/1 "2014-03-25T16:40:53Z")

</div>

Hi Experts,  
As follow is my program to test stream\_mux block. I found when  
dat1\_num+dat2\_num \> 8192, the result was wrong.  
Is there something I have made a mistake?  
My gnuradio version is v3.7.4git-35-g1092e685

#!/usr/bin/env python  
from gnuradio import gr  
from gnuradio import blocks  
if **name** == ‘ **main** ’:  
tb = gr.top\_block ()  
dat1\_num = 3  
dat2\_num = 8191

```
    dat1 = [1] * dat1_num
    dat1_src = blocks.vector_source_f(dat1)

    dat2 = [2] * dat2_num
    dat2_src = blocks.vector_source_f(dat2)

    tmp_dat = dat1 + dat2
    tmp_dst = blocks.vector_sink_f()

    mux = blocks.stream_mux(gr.sizeof_float, (dat1_num, dat2_num))

    tb.connect((dat1_src, 0), (mux, 0))
    tb.connect((dat2_src, 0), (mux, 1))
    tb.connect(mux, tmp_dst)
    tb.run ()
    if (tuple(tmp_dat) == tmp_dst.data()):
        print "fine"
    else:
        print len(tmp_dst.data())
```

---

<div class="post-metadata">

**Author:** ![Tiankun\_Hu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@Tiankun\_Hu](https://www.ruby-forum.com/u/Tiankun_Hu)\
**Post date:** [March 25, 2014, 6:18pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/2 "2014-03-25T18:18:00Z")

</div>

On 03/25/2014 03:59 PM, Tiankun Hu wrote:

> Hi Experts,  
> As follow is my program to test stream\_mux block. I found when  
> dat1\_num+dat2\_num \> 8192, the result was wrong.  
> Is there something I have made a mistake?

There might be a bug in that block, although when you’re streaming, it  
should work (i.e. not when you have a static case).

M

---

<div class="post-metadata">

**Author:** ![Tiankun\_Hu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@Tiankun\_Hu](https://www.ruby-forum.com/u/Tiankun_Hu)\
**Post date:** [March 25, 2014, 9:39pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/3 "2014-03-25T21:39:15Z")

</div>

On 03/25/2014 06:15 PM, Martin B. wrote:

> On 03/25/2014 03:59 PM, Tiankun Hu wrote:
> 
> > Hi Experts,  
> > As follow is my program to test stream\_mux block. I found when  
> > dat1\_num+dat2\_num \> 8192, the result was wrong.  
> > Is there something I have made a mistake?
> 
> There might be a bug in that block, although when you’re streaming, it  
> should work (i.e. not when you have a static case).

I checked the code, there was indeed a bit of a bug with finite stream  
lengths. Commited a fix.

Cheers,  
M

---

<div class="post-metadata">

**Author:** ![Tiankun\_Hu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@Tiankun\_Hu](https://www.ruby-forum.com/u/Tiankun_Hu)\
**Post date:** [March 26, 2014, 2:15pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/4 "2014-03-26T14:15:29Z")

</div>

Hi Martin,  
I haven’t found your committed in master branch yet, could you share  
your diff?

于 2014年03月26日 04:37, Martin B. 写道:

> I checked the code, there was indeed a bit of a bug with finite stream  
> lengths. Commited a fix.
> 
> Cheers,  
> M

–  
Thanks  
Tiankun

---

<div class="post-metadata">

**Author:** ![Tiankun\_Hu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@Tiankun\_Hu](https://www.ruby-forum.com/u/Tiankun_Hu)\
**Post date:** [March 27, 2014, 9:56am UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/5 "2014-03-27T09:56:03Z")

</div>

On 03/26/2014 02:13 PM, Tiankun Hu wrote:

> Hi Martin,  
> I haven’t found your committed in master branch yet, could you share  
> your diff?

[https://github.com/mbr0wn/gnuradio/tree/blocks/stream\_mux](https://github.com/mbr0wn/gnuradio/tree/blocks/stream_mux)

M

---

<div class="post-metadata">

**Author:** ![Tiankun\_Hu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/46a35a/32.png) [@Tiankun\_Hu](https://www.ruby-forum.com/u/Tiankun_Hu)\
**Post date:** [March 27, 2014, 2:26pm UTC](https://www.ruby-forum.com/t/is-a-bug-about-stream-mux-block/240047/6 "2014-03-27T14:26:50Z")

</div>

Thanks your help, it works fine now.

于 2014年03月27日 16:54, Martin B. 写道:

> > 于 2014年03月26日 04:37, Martin B. 写道:
> > 
> > > I checked the code, there was indeed a bit of a bug with finite stream  
> > > Discuss-gnuradio mailing list  
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

–  
Thanks  
Tiankun
