简体   繁体   English

Android上的GStreamer x264enc和SIGSEGV

[英]GStreamer x264enc and SIGSEGV on Android

I am trying to play around with GStreamer-java and it's h.264 encoder (x264enc) on Android. 我正在尝试使用GStreamer-java,它是Android上的h.264编码器(x264enc)。

Now, I tried to encode raw video from test video source (set its is-live property to TRUE ), and when data starts flowing into the x264enc Element, I get SIGSEGV in libx264.so and my app crashes. 现在,我尝试对来自测试视频源的原始视频进行编码(将其is-live属性设置为TRUE ),并且当数据开始流入x264enc元素时,我在libx264.so中得到了SIGSEGV,并且我的应用程序崩溃了。 And it looks like code is dereferencing a NULL... Exact error location is in file "gstreamer_ndk_bundle/x264/encoder/analyse.c" line 963. And it is this line: 而且看起来代码正在取消引用NULL ...确切的错误位置在文件“ gstreamer_ndk_bundle / x264 / encoder / analyse.c”行963中。这行是:

h->mc.memcpy_aligned( h->mb.pic.i8x8_dct_buf, h->dct.luma8x8, sizeof(h->mb.pic.i8x8_dct_buf) );

My device's CPU is Cortex 8 and it has NEON feature... 我设备的CPU是Cortex 8,并且具有NEON功能...

I tried to printout to a file all h structure fields, and no field is uninitialized. 我试图将所有h结构字段打印输出到文件,并且没有字段被初始化。

Android DEBUG info from LogCat: HERE 来自LogCat的Android DEBUG信息: 此处

My questions: 我的问题:

  1. How can I know what is throwing SIGSEGV, because this line of code seems to be ok? 我怎么知道抛出SIGSEGV是什么,因为这行代码似乎还行吗?
  2. Is this a known bug or an expected behavior of x264 encoder on ARM CPU or I am missing some encoder configuration? 这是x264编码器在ARM CPU上的已知错误或预期行为,还是缺少某些编码器配置?
  3. I noticed that if I set property analyse of the encoder to 0x3:0x113 ( some random value I found online ) I don't get SIGSEGV, encoder seems to work, but I get error in pipeline: Data flow error . 我注意到,如果将编码器的属性分析设置为0x3:0x113我在网上找到一些随机值 ),则不会得到SIGSEGV,编码器似乎可以正常工作,但是管道中出现错误: 数据流错误 Can I just set analyse to a meaningful value? 我可以将分析设置为有意义的值吗?

Update 更新

I fprintf-ed all important "h" fields just before execution runs in x264_mb_analyse_intra() function and just before the line that it breaks, guess it could help: http://pastebin.com/sAfX239j 在执行在x264_mb_analyse_intra()函数中运行之前和行中断之前,我fprintf-ed所有重要的“ h”字段,它可能会有所帮助: http : //pastebin.com/sAfX239j

As you can see HERE , problem is in x264_memcpy_aligned function which for some reason is jumping to zero address, and that makes SIGSEGV happen. 正如你可以看到这里 ,问题是在x264_memcpy_aligned由于某种原因被跳转到零个地址的功能,这使得SIGSEGV发生。 To fix this comment out this line: 要将此注释修正为以下内容:

pf->memcpy_aligned = x264_memcpy_aligned_neon;

In file /x264/common/arm/mc-cc . 在文件/x264/common/arm/mc-cc It is supposed to be 250th line but I found out that it is not, so search for that text, it only occurs once in the file. 它应该是第250行,但我发现不是,所以搜索该文本,它仅在文件中出现一次。

Now x264enc is working on Android, with less NEON support though... 现在x264enc正在Android上运行,但对NEON的支持较少。

If you follow this thread you will see that guys are working on fixing this problem, so this hack will soon be unimportant. 如果您遵循此主题,您会看到伙计们正在努力解决此问题,因此此黑客很快将变得无关紧要。

If you want to debug it yourself, see these: 如果要自己调试,请参阅以下内容:

  1. Stack trace 堆栈跟踪
  2. Field values before the function it breaks, and before line that it breaks 函数中断之前和行中断之前的字段值
  3. ELF of unstripped libx264.so library 未剥离的libx264.so库的ELF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM