After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754768 - matroskademux: Streaming via tcpserversink fails - reading large block not supported
matroskademux: Streaming via tcpserversink fails - reading large block not su...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.5.90
Other All
: Normal blocker
: 1.5.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-09 10:35 UTC by Peter Maersk-Moller
Modified: 2015-09-10 19:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
matroskamux: fix matroskamux ! matroskademux (1.70 KB, patch)
2015-09-10 15:03 UTC, Tim-Philipp Müller
committed Details | Review
matroskamux: drop HEADER flag from output buffers (1.36 KB, patch)
2015-09-10 18:29 UTC, Thiago Sousa Santos
committed Details | Review

Description Peter Maersk-Moller 2015-09-09 10:35:05 UTC
I'm been having a bit of a problem with Matroska streaming ever since 1.5.x. Now using 1.5.90.

The same pipeline report differently depending on when to start the pipeline. Here is the first example:

gst-launch-1.0 tcpclientsrc host=stream01 port=5010 ! decodebin name=dec  ! autovideosink dec. ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:dec/GstMatroskaDemux:matroskademux0: Could not demultiplex stream.
Additional debug info:
matroska-demux.c(4004): gst_matroska_demux_check_read_size (): /GstPipeline:pipeline0/GstDecodeBin:dec/GstMatroskaDemux:matroskademux0:
reading large block of size 135481368 not supported; file might be corrupt.
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
[01:16:10.943] vtDecompressionDuctCreate signalled err=-8973 (err) (Could not select and open decoder instance) at /SourceCache/CoreMedia_frameworks/CoreMedia-1562.235/Sources/VideoToolbox/VTDecompressionSession.c line 1181
Freeing pipeline ...

Here is another example of output:

gst-launch-1.0 tcpclientsrc host=stream01 port=5010 ! decodebin name=dec  ! autovideosink dec. ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
[01:19:42.317] vtDecompressionDuctCreate signalled err=-8973 (err) (Could not select and open decoder instance) at /SourceCache/CoreMedia_frameworks/CoreMedia-1562.235/Sources/VideoToolbox/VTDecompressionSession.c line 1181
ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2943): void gst_base_src_loop(GstPad *) (): /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0:
streaming task paused, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

A serving pipeline could look something like this:

----------------------------
#!/bin/bash
width=1280
height=720
framerate="30/1"
audiorate=44100
channels=2
socket=/tmp/snowmixdummy
SHMSIZE='shm-size='`echo "$width * $height * 4 * 34"|bc`
SHMOPTION="wait-for-connection=0 sync=true"
SHMSINK1="shmsink socket-path=$socket $SHMSIZE $SHMOPTION"
AUDIOFORMAT='audio/x-raw,format=S16LE,channels='$channels',layout=interleaved,rate='$audiorate
#VIDEOFORMAT='video/x-raw,format=BGRA,width='$width',height='$height',framerate='$framerate
VIDEOFORMAT='video/x-raw,format=BGRA,width='$width',height='$height'

ENCAUDIO='audio/mpeg,mpegversion=4,stream-format=raw'
ENCVIDEO='video/x-h264,alignment=au,stream-format=byte-stream,profile=main'
VIDEOSRC='shmsrc socket-path='$socket' do-timestamp=true is-live=true'
AAC_ENC='avenc_aac bitrate=128000 compliance=-2'
X264ENC='x264enc bitrate=4000 speed-preset=2 tune=zerolatency key-int-max=60 bframes=0'
gst-launch-1.0 -v                        \
        audiotestsrc is-live=true       !\
        $AUDIOFORMAT                    !\
        queue leaky=2                   !\
        audiorate                       !\
        audioconvert                    !\
        $AAC_ENC                        !\
        $ENCAUDIO                       !\
        aacparse                        !\
        matmux.                          \
        videotestsrc is-live=true       !\
        $VIDEOFORMAT,framerate=30/1     !\
        queue leaky=2                   !\
        videoconvert                    !\
        $X264ENC                        !\
        $ENCVIDEO                       !\
        h264parse                       !\
        queue                           !\
        matroskamux streamable=1 name=matmux    !\
        queue                           !\
        tcpserversink host=0.0.0.0 port=5010 sync-method=2 recover-policy=keyframe
----------------------------
Comment 1 Sebastian Dröge (slomo) 2015-09-09 11:13:07 UTC
And this was working with 1.4, right? The first and second error seem unrelated at a first glance. Can you also reproduce the second one if avdec_h264 is used instead of vtdec?
Comment 2 Peter Maersk-Moller 2015-09-09 14:16:09 UTC
(In reply to Sebastian Dröge (slomo) from comment #1)
> And this was working with 1.4, right? The first and second error seem
> unrelated at a first glance. Can you also reproduce the second one if
> avdec_h264 is used instead of vtdec?

Using this pipeline on Mac I get repeatedly the "large block" error.

gst-launch-1.0 -v tcpclientsrc host=127.0.0.1 port=5010 ! queue ! matroskaparse ! matroskademux name=demux ! queue ! h264parse ! avdec_h264 ! queue ! videoconvert ! glimagesink

Using this on Mac and Linux I get repeatedly the "large block" error.

gst-launch-1.0 -v tcpclientsrc host=127.0.0.1 port=5010 ! decodebin name=dec  ! autovideosink dec. ! autoaudiosink

However on Mac, it sometimes just PREROLL and hangs.

Currently I seems to be unable to reproduce the 'VTDecompressionSession.c line 1181" error.
Comment 3 Peter Maersk-Moller 2015-09-09 14:28:10 UTC
Adding a matroskaparse element to the encoding script makes the encoding script it self fail with the large block error. That ought to make it easier to track down the error.

The script has been cleaned a bit compared to first version and a queue extra after the aacparse was added along with the matroskaparse element.

#!/bin/bash
width=1280
height=720
framerate="30/1"
audiorate=44100
channels=2
socket=/tmp/snowmixdummy
AUDIOFORMAT='audio/x-raw,format=S16LE,channels='$channels',layout=interleaved,rate='$audiorate
VIDEOFORMAT='video/x-raw,format=BGRA,width='$width',height='$height'

ENCAUDIO='audio/mpeg,mpegversion=4,stream-format=raw'
ENCVIDEO='video/x-h264,alignment=au,stream-format=byte-stream,profile=main'
VIDEOSRC='shmsrc socket-path='$socket' do-timestamp=true is-live=true'
AAC_ENC='avenc_aac bitrate=128000 compliance=-2'
X264ENC='x264enc bitrate=4000 speed-preset=2 tune=zerolatency key-int-max=60 bframes=0'
gst-launch-1.0 -v                        \
        audiotestsrc is-live=true       !\
        $AUDIOFORMAT                    !\
        queue leaky=2                   !\
        audiorate                       !\
        audioconvert                    !\
        $AAC_ENC                        !\
        $ENCAUDIO                       !\
        aacparse                        !\
        queue                           !\
        matmux.                          \
        videotestsrc is-live=true       !\
        $VIDEOFORMAT,framerate=30/1     !\
        queue leaky=2                   !\
        videoconvert                    !\
        $X264ENC                        !\
        $ENCVIDEO                       !\
        h264parse                       !\
        queue                           !\
        matroskamux streamable=1 name=matmux    !\
        matroskaparse                   !\
        queue                           !\
        tcpserversink host=0.0.0.0 port=5010 sync-method=2 recover-policy=keyframe
----------------------------
Comment 4 Sebastian Dröge (slomo) 2015-09-09 14:33:03 UTC
The vtdec related stuff is probably a completely different bug, let's ignore that for now and handle it in a different bug report.


You said that it worked in 1.4, so this would be a regression in matroskamux or tcpserversink I guess.
Comment 5 Sebastian Dröge (slomo) 2015-09-09 14:39:43 UTC
> gst-launch-1.0 videotestsrc ! x264enc ! matroskamux streamable=true ! queue ! matroskademux ! fakesink

Also fails, also with matroskaparse instead of matroskademux.
Comment 6 Thiago Sousa Santos 2015-09-09 22:55:08 UTC
Can you share in what version did this work?
Comment 7 Thiago Sousa Santos 2015-09-09 22:55:24 UTC
(In reply to Thiago Sousa Santos from comment #6)
> Can you share in what version did this work?

Fails with my system's 1.4.5 on debian.
Comment 8 Peter Maersk-Moller 2015-09-10 07:58:36 UTC
It is true, that Sebastians matroskamux-matroskaparse exmaple also fails for me on 1.4.5. However the example with tcpclientsink shown below here works with the pipeline "gst-launch-1.0 tcpclientsrc host=127.0.0.1 port=5010 ! decodebin name=dec  ! autovideosink dec. ! autoaudiosink" on 1.4.5, but fails with the "large block" error on 1.5.90.

#!/bin/bash
width=1280
height=720
framerate="30/1"
audiorate=44100
channels=2
AUDIOFORMAT='audio/x-raw,format=S16LE,channels='$channels',layout=interleaved,rate='$audiorate
VIDEOFORMAT='video/x-raw,format=BGRA,width='$width',height='$height'
ENCAUDIO='audio/mpeg,mpegversion=4,stream-format=raw'
ENCVIDEO='video/x-h264,alignment=au,stream-format=byte-stream,profile=main'
AAC_ENC='avenc_aac bitrate=128000 compliance=-2'
X264ENC='x264enc bitrate=4000 speed-preset=2 tune=zerolatency key-int-max=60 bframes=0'
gst-launch-1.0 -v                        \
        audiotestsrc is-live=true       !\
        $AUDIOFORMAT                    !\
        queue leaky=2                   !\
        audiorate                       !\
        audioconvert                    !\
        $AAC_ENC                        !\
        $ENCAUDIO                       !\
        aacparse                        !\
        queue                           !\
        matmux.                          \
        videotestsrc is-live=true       !\
        $VIDEOFORMAT,framerate=30/1     !\
        queue leaky=2                   !\
        videoconvert                    !\
        $X264ENC                        !\
        $ENCVIDEO                       !\
        h264parse                       !\
        queue                           !\
        matroskamux streamable=1 name=matmux    !\
        queue                           !\
        tcpserversink host=0.0.0.0 port=5010 sync-method=2 recover-policy=keyframe
Comment 9 Peter Maersk-Moller 2015-09-10 08:00:35 UTC
Here is the correct script for tcpserversink. There was a "'" too much.

#!/bin/bash
width=1280
height=720
framerate="30/1"
audiorate=44100
channels=2
socket=/tmp/snowmixdummy
AUDIOFORMAT='audio/x-raw,format=S16LE,channels='$channels',layout=interleaved,rate='$audiorate
VIDEOFORMAT='video/x-raw,format=BGRA,width='$width',height='$height

ENCAUDIO='audio/mpeg,mpegversion=4,stream-format=raw'
ENCVIDEO='video/x-h264,alignment=au,stream-format=byte-stream,profile=main'
VIDEOSRC='shmsrc socket-path='$socket' do-timestamp=true is-live=true'
AAC_ENC='avenc_aac bitrate=128000 compliance=-2'
X264ENC='x264enc bitrate=4000 speed-preset=2 tune=zerolatency key-int-max=60 bframes=0'
gst-launch-1.0 -v                        \
        audiotestsrc is-live=true       !\
        $AUDIOFORMAT                    !\
        queue leaky=2                   !\
        audiorate                       !\
        audioconvert                    !\
        $AAC_ENC                        !\
        $ENCAUDIO                       !\
        aacparse                        !\
        queue                           !\
        matmux.                          \
        videotestsrc is-live=true       !\
        $VIDEOFORMAT,framerate=30/1     !\
        queue leaky=2                   !\
        videoconvert                    !\
        $X264ENC                        !\
        $ENCVIDEO                       !\
        h264parse                       !\
        queue                           !\
        matroskamux streamable=1 name=matmux    !\
        matroskaparse                   !\
        queue                           !\
        tcpserversink host=0.0.0.0 port=5010 sync-method=2 recover-policy=keyframe
Comment 10 Tim-Philipp Müller 2015-09-10 15:03:47 UTC
Created attachment 311086 [details] [review]
matroskamux: fix matroskamux ! matroskademux

    Don't carry over DISCONT flags from the input buffers to the
    output buffer, or the demuxer might reset its state when it
    receives the first data buffer just after parsing the simple
    block header, and then expect sane data to follow.
    Fixes matroskamux ! demux erroring out.
Comment 11 Thiago Sousa Santos 2015-09-10 17:49:07 UTC
commit d518033e77259a9ba79a7619c4791f345a7b92d7
Author: Josep Torra <n770galaxy@gmail.com>
Date:   Fri Nov 7 15:50:51 2014 +0100

    h264parse: set the HEADER flag on buffers containing SPS or PPS


Bisecting led me to this commit on -bad.
Comment 12 Thiago Sousa Santos 2015-09-10 18:29:30 UTC
Created attachment 311099 [details] [review]
matroskamux: drop HEADER flag from output buffers

Drop HEADER flag from output buffers if they are not indeed
headers.

Fixes resending of headers in tcp connection handling
Comment 13 Sebastian Dröge (slomo) 2015-09-10 19:06:57 UTC
Comment on attachment 311099 [details] [review]
matroskamux: drop HEADER flag from output buffers

Any other flags to consider? :)
Comment 14 Thiago Sousa Santos 2015-09-10 19:41:44 UTC
commit f9c7dc2797cd7df1438ff374f40bd94f0a011451
Author: Thiago Santos <thiagoss@osg.samsung.com>
Date:   Thu Sep 10 15:26:54 2015 -0300

    matroskamux: drop HEADER flag from output buffers
    
    Drop HEADER flag from output buffers if they are not indeed
    headers.
    
    Fixes resending of headers in tcp connection handling
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754768