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 794593 - [Android omxbrcmvideoh264hwencoder] AMC encodebin fails with "Internal data stream error."
[Android omxbrcmvideoh264hwencoder] AMC encodebin fails with "Internal data s...
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.12.4
Other other
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-22 10:38 UTC by Denis Shienkov
Modified: 2018-03-22 16:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Startup code (5.40 KB, text/plain)
2018-03-22 10:38 UTC, Denis Shienkov
Details
AMC encoder debugging log (5.54 KB, text/plain)
2018-03-22 10:39 UTC, Denis Shienkov
Details
BRCM encoder with main profile debug log (6.97 KB, text/plain)
2018-03-22 12:24 UTC, Denis Shienkov
Details
BRCM encoder with baseline profile debug log (5.95 KB, text/plain)
2018-03-22 13:20 UTC, Denis Shienkov
Details
CAPS without of x264parse element (34.56 KB, text/plain)
2018-03-22 16:15 UTC, Denis Shienkov
Details
CAPS with x264parse element (225.50 KB, text/plain)
2018-03-22 16:15 UTC, Denis Shienkov
Details

Description Denis Shienkov 2018-03-22 10:38:31 UTC
Created attachment 370001 [details]
Startup code

I want to use an Android's HW h264 encoder (instead of SW x264enc) to encode a video stream.

In my code I use simple pipeline:

[code]
...
    const QByteArray launch = "videotestsrc name=appsrc "
                              "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc "
                              "! rtph264pay name=pay "
                              "! udpsink name=udpsink";
    GError *error = nullptr;
    m_pipeline = ::gst_parse_launch(launch.constData(), &error);
...
    const auto status = ::gst_element_set_state(m_pipeline,
                                                GST_STATE_PLAYING);
...
[/code]

All functions returns successfully, but from the logs I see following errors:

[quote]
D/GStreamer+amcvideoenc(17480): 0:00:41.004486081 0x56d05890 gstamcvideoenc.c:856:gst_amc_video_enc_handle_output_frame:<videoenc> got codecconfig in byte-stream format
D/GStreamer+amcvideoenc(17480): 0:00:41.007110593 0x56d05890 gstamcvideoenc.c:1070:gst_amc_video_enc_loop:<videoenc> Finished frame: not-negotiated
W/GStreamer+amcvideoenc(17480): 0:00:41.008331296 0x56d05890 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error.
W/GStreamer+amcvideoenc(17480): 0:00:41.009124753 0x56d05890 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-negotiated (-4)
[/quote]

I don't know what I han fix this.

Please see attachments with my code and full log with ("amc*:6") debug level.
Comment 1 Denis Shienkov 2018-03-22 10:39:35 UTC
Created attachment 370002 [details]
AMC encoder debugging log
Comment 2 Denis Shienkov 2018-03-22 10:48:37 UTC
UPD: I use Android 5.5.1 (Cyanogen-mod 12.1) on GT-S7270.
Comment 3 Denis Shienkov 2018-03-22 10:49:57 UTC
s/5.5.1/5.1.1
Comment 4 Denis Shienkov 2018-03-22 12:23:58 UTC
If I try to add to a pipeline a profile string:

[code]
...
    const QByteArray launch = "videotestsrc name=appsrc "
                              "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc "
                              "! video/x-h264, profile=main "  // << This string
                              "! rtph264pay name=pay "
                              "! udpsink name=udpsink";
...
[/code]

then I got other errors (please, see brcm-encoder-with-profile.log)
Comment 5 Denis Shienkov 2018-03-22 12:24:37 UTC
Created attachment 370007 [details]
BRCM encoder with main profile debug log
Comment 6 Denis Shienkov 2018-03-22 12:32:02 UTC
If I try to use the 'video/x-h264, profile=high', then I got same error:

[quote]

...

"Pipeline linking with recoverable error, domain: 1468 code: 3 : "could not link videoenc to pay, videoenc can't handle caps video/x-h264, profile=(string)high""

...

D/GStreamer+amcvideoenc(12027): 0:00:48.762756347 0x55f8e490 gstamcvideoenc.c:1070:gst_amc_video_enc_loop:<videoenc> Finished frame: not-linked
W/GStreamer+amcvideoenc(12027): 0:00:48.763122558 0x55f8e490 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error.
W/GStreamer+amcvideoenc(12027): 0:00:48.763183593 0x55f8e490 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-linked (-1)
E/GStreamer+amcvideoenc(12027): 0:00:48.765808106 0x55f6bcf0 gstamcvideoenc.c:1542:gst_amc_video_enc_handle_frame:<videoenc> Downstream returned not-linked

...

[/quote]
Comment 7 Nicolas Dufresne (ndufresne) 2018-03-22 12:44:55 UTC
That just mean high is not supported, old phones don't support that. Can you test with baseline or constrained-baseline profile ?
Comment 8 Denis Shienkov 2018-03-22 13:19:58 UTC
With baseline profile:

[code]
...
    const QByteArray launch = "videotestsrc name=appsrc "
                              "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc "
                              "! video/x-h264, profile=baseline "
                              "! rtph264pay name=pay "
                              "! udpsink name=udpsink";
...
[/code]

I got:

[quote]
W/GStreamer+amcvideoenc(13112): 0:00:29.859680177 0x54ffd580 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error.
W/GStreamer+amcvideoenc(13112): 0:00:29.860076905 0x54ffd580 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-negotiated (-4)
[/quote]

please see 'brcm-encoder-with-baseline-profile.log'.
Comment 9 Denis Shienkov 2018-03-22 13:20:26 UTC
Created attachment 370012 [details]
BRCM encoder with baseline profile debug log
Comment 10 Denis Shienkov 2018-03-22 13:28:54 UTC
With 'constrained-baseline' profile I got same error as with 'baseline' profile.
Comment 11 Nicolas Dufresne (ndufresne) 2018-03-22 14:45:49 UTC
Can you add a parser between the encoder and rtph264pay (i.e. enc ! h264parse ! rtph264pay). Also, we'll need GST_DEBUG="*CAPS*:5" to debug this not negotiated issue if it still exist after adding the missing parser.
Comment 12 Denis Shienkov 2018-03-22 15:56:34 UTC
WOW, this worked with 'h264parse' !!! :) Many thanks.
Comment 13 Nicolas Dufresne (ndufresne) 2018-03-22 15:58:17 UTC
We try hard to make the parser optional with H264 payloader, so I'd like if you could share the CAPS trace, so we can see which fields the encoder didn't set. Maybe we could do something about it.
Comment 14 Denis Shienkov 2018-03-22 16:14:56 UTC
I have added two log files: 

* caps-with-parse.log
* caps-no-parse.log
Comment 15 Denis Shienkov 2018-03-22 16:15:22 UTC
Created attachment 370018 [details]
CAPS without of x264parse element
Comment 16 Denis Shienkov 2018-03-22 16:15:46 UTC
Created attachment 370019 [details]
CAPS with x264parse element
Comment 17 Nicolas Dufresne (ndufresne) 2018-03-22 16:25:17 UTC
Comment on attachment 370018 [details]
CAPS without of x264parse element

Ok, the encoder does not set much information because Android does not provide much information. I'll try to remember, but a parser is needed with these encoders.