Git Product home page Git Product logo

screenrecorder's Introduction

本Demo是在作者Yrom的项目 ScreenRecorder 的基础上额外增加了悬浮窗和通知栏等特性,详情见我的博文Android实现录屏直播(二)需求才是硬道理之产品功能调研,而后又参考了 LakeinChina 作者的 librestreaming 实现推流,目前正在逐步完善中。

Updated 7.12

年初买的阿里云的ECS服务器已经到期了,所以大家无法使用之前的IP进行测试了,请大家自行搭建服务器使用吧~

Updated 5.31

工作较忙,一直没时间接着干活,终于抽了一晚上来凑合集成了音频,大家可以试试。

Updated 4.25

目前只实现了录屏的 Video 推流,有朋友提到音频迟迟没有,还有摄像头采集也将纳入计划。

TODO LIST

  • 加入摄像头采集及推流(包含拍摄直播、录屏直播两种功能,目前 Camera 还不能用,需要完善)

  • 代码重构,改善代码的可读性,并且往 SDK 的方向推进

  • ​ 加入音频采集及推流 (原谅我直接用的 librestreaming 里面的音频采集及软解码的代码,太忙了没时间自己搞)

  • ​ 修复视频端对端延迟过长的问题(目前测试 3~6 s 左右,如果还有问题的可以 M 我)


Updated 3.12

Demo 中集成了录屏直播推流的功能,内含个人自己搭建的 Nginx + rtmp 流媒体服务器,去掉了录屏存入本地文件的部分代码,之后会重新建项目完全移植过去,并且计划拥有滤镜和OpenGL来控制帧率等功能。 需要的朋友可以自行使用,推流格式:rtmp://59.130.110.19:1935/live/yourstreamingkey

仿Bilibili悬浮窗与通知栏

效果图

录屏推流直播

推流效果图

Screen Recorder

这是个 DEMO APP 主要是实现了屏幕录制功能。

通过使用 MediaProjectionManager, VirtualDisplay, MediaCodec 以及 MediaMuxer 等API,故而这个项目仅支持Android 5.0。

原理

  • Display 可以“投影”到一个 VirtualDisplay
  • 通过 MediaProjectionManager 取得的 MediaProjection创建VirtualDisplay
  • VirtualDisplay 会将图像渲染到 Surface中,而这个Surface是由MediaCodec所创建的
mEncoder = MediaCodec.createEncoderByType(MIME_TYPE);
...
mSurface = mEncoder.createInputSurface();
...
mVirtualDisplay = mMediaProjection.createVirtualDisplay(name, mWidth, mHeight, mDpi, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC, mSurface, null, null);
  • MediaMuxer 将从 MediaCodec 得到的图像元数据封装并输出到MP4文件中
int index = mEncoder.dequeueOutputBuffer(mBufferInfo, TIMEOUT_US);
...
ByteBuffer encodedData = mEncoder.getOutputBuffer(index);
...
mMuxer.writeSampleData(mVideoTrackIndex, encodedData, mBufferInfo);

所以其实在Android 4.4上可以通过DisplayManager来创建VirtualDisplay也是可以实现录屏,但因为权限限制需要ROOT。 (see DisplayManager.createVirtualDisplay())

screenrecorder's People

Contributors

myrao avatar yrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screenrecorder's Issues

用b站播放器拉流一开始延时

用的是b站的播放器,一开始拉流的时候我看了下帧率只有个位数,延时很高,操作一会帧率上去了延时也慢慢降低了。。。。这个要怎么优化呢

64 位 so 调 close 方法 crash

2019-09-21 12:58:18.481 26929-27070/net.yrom.screenrecorder A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x74892eb0f4 in tid 27070 (pool-1-thread-1), pid 26929 (.screenrecorder)

2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: LineageOS Version: '15.1-20190917-UNOFFICIAL-enchilada'
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus6/OnePlus6:8.1.0/OPM1.171019.011/06140300:user/release-keys'
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: Revision: '0'
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: ABI: 'arm64'
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: pid: 26929, tid: 27070, name: pool-1-thread-1 >>> net.yrom.screenrecorder <<<
2019-09-21 12:58:18.565 27385-27385/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x74892eb0f4
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x0 00000074892e6fc4 x1 00000074892e6fc4 x2 000000748a052ac0 x3 0000000000000001
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x4 0000007100000000 x5 0000000000000000 x6 0000000071bf4060 x7 7f7f7f7f7f7f7f7f
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x8 0000000000004138 x9 0000000000004252 x10 0000000000430000 x11 00000074a35487b8
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x12 0000007527ad6990 x13 2c97f2b628e67dd5 x14 0000007527ad6000 x15 ffffffffffffffff
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x16 000000748b565e80 x17 000000748b54aff8 x18 0000000000000008 x19 00000074892e6fc4
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x20 00000074a3461420 x21 0000000013244308 x22 00000074892e8588 x23 0000000000000000
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x24 0000000012e557e8 x25 0000000012e55868 x26 0000000000000008 x27 0000000000000071
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: x28 000000000001122a x29 00000074892e6f80 x30 000000748b551128
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: sp 00000074892e6b00 pc 000000748b54b174 pstate 0000000080000000
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: backtrace:
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: #00 pc 0000000000009174 /data/app/net.yrom.screenrecorder-SdZl7p6UPQe4DSi5DCM8WQ==/lib/arm64/libscreenrecorderrtmp.so (RTMP_Close+380)
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: #1 pc 000000000000f124 /data/app/net.yrom.screenrecorder-SdZl7p6UPQe4DSi5DCM8WQ==/lib/arm64/libscreenrecorderrtmp.so (Java_net_yrom_screenrecorder_rtmp_RtmpClient_close+20)
2019-09-21 12:58:18.566 27385-27385/? A/DEBUG: #2 pc 000000000000f0b8 /data/app/net.yrom.screenrecorder-SdZl7p6UPQe4DSi5DCM8WQ==/oat/arm64/base.odex (offset 0xf000)
2019-09-21 12:58:19.380 931-931/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_06

demo 运行崩溃

小米8运行该demo时出现崩溃,崩溃日志如下
2019-03-07 15:38:35.743 28905-28990/net.yrom.screenrecorder E/AndroidRuntime: FATAL EXCEPTION: AudioSenderThread
Process: net.yrom.screenrecorder, PID: 28905
java.lang.IllegalStateException: Deque full
at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:335)
at java.util.concurrent.LinkedBlockingDeque.add(LinkedBlockingDeque.java:633)
at net.yrom.screenrecorder.task.RtmpStreamingSender.sendFood(RtmpStreamingSender.java:139)
at net.yrom.screenrecorder.ui.activity.ScreenRecordActivity$2.collect(ScreenRecordActivity.java:112)
at net.yrom.screenrecorder.task.AudioSenderThread.sendRealData(AudioSenderThread.java:112)
at net.yrom.screenrecorder.task.AudioSenderThread.run(AudioSenderThread.java:70)
2019-03-07 15:38:35.745 28905-28990/net.yrom.screenrecorder E/MQSEventManagerDelegate: failed to get MQSService.
2019-03-07 15:38:35.750 28905-28984/net.yrom.screenrecorder D/RESLog: VideoSenderThread,MediaCode,eobIndex=0

转码问题

博主 您好:

请问 录屏输出的H264格式的,如何转换为YUV420 格式的数据,如知晓,麻烦告知一下,谢谢

报错没有找到C++的那个代码怎么办

Process: com.live.lhzs, PID: 7974
java.lang.UnsatisfiedLinkError: No implementation found for long com.live.lhzs.rtmp.RtmpClient.open(java.lang.String, boolean) (tried Java_com_live_lhzs_rtmp_RtmpClient_open and Java_com_live_lhzs_rtmp_RtmpClient_open__Ljava_lang_String_2Z)
at com.live.lhzs.rtmp.RtmpClient.open(Native Method)
at com.live.lhzs.task.RtmpStreamingSender.run(RtmpStreamingSender.java:61)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)

录屏推流一到播放视频就卡住不动

APP普通操作画面的推流是没有问题,但一到播放视频时发现只看到前面几个画面,后面的就卡住无法运行下去了,我打了断点发现是Native方法一直在阻塞,具体出现在RtmpStreamingSender这个类中“
int res = RtmpClient.write(jniRtmpPointer, flvData.byteBuffer, flvData.byteBuffer.length, flvData.flvTagType, flvData.dts)” 执行到这行代码就卡住好久才往下执行。投屏的参数:VIDEO_WIDTH = 1280;VIDEO_HEIGHT = 720; VIDEO_BITRATE = 50010002; FPS = 20; 请问该如何优化?

截屏推流无关键帧的情况

请问截屏推流时,停在不动的屏幕一会儿,推流那儿得不到新的数据,影响到观看端卡顿或者延迟很长的情况如何处理?上一个关键帧可以存起来再发送出去吗?

捕获端自己做媒体服务器

能不能省略掉远端的的流媒体服务器,而是在android手机端打一个流媒体服务器呢?忽略并发、压力之类的东西。

senderQueue is full,abandon 这怎么办啊

2020-10-27 15:28:16.314 8550-8772/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.322 8550-8764/com.live.LJZSLive D/RESLog: VideoSenderThread,MediaCode,eobIndex=0
2020-10-27 15:28:16.323 8550-8764/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.323 8550-8772/com.live.LJZSLive D/ContentValues: AudioSenderThread,MediaCode,eobIndex=1
2020-10-27 15:28:16.323 8550-8772/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.324 8550-8772/com.live.LJZSLive D/ContentValues: AudioSenderThread,MediaCode,eobIndex=2
2020-10-27 15:28:16.324 8550-8772/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.327 8550-8772/com.live.LJZSLive D/ContentValues: AudioSenderThread,MediaCode,eobIndex=3
2020-10-27 15:28:16.327 8550-8772/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.328 8550-8772/com.live.LJZSLive D/ContentValues: AudioSenderThread,MediaCode,eobIndex=0
2020-10-27 15:28:16.328 8550-8772/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.333 8550-8764/com.live.LJZSLive D/RESLog: VideoSenderThread,MediaCode,eobIndex=1
2020-10-27 15:28:16.333 8550-8764/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.348 8550-8764/com.live.LJZSLive D/RESLog: VideoSenderThread,MediaCode,eobIndex=0
2020-10-27 15:28:16.348 8550-8764/com.live.LJZSLive D/RESLog: senderQueue is full,abandon
2020-10-27 15:28:16.368 8550-8764/com.live.LJZSLive D/RESLog: VideoSenderThread,MediaCode,eobIndex=0
2020-10-27 15:28:16.368 8550-8764/com.live.LJZSLive D/RESLog: senderQueue is full,abandon

这里什么问题啊库找不到了?大佬

第一个:
2020-10-17 13:16:20.038 9384-9813/com.live.bensonlive A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc in tid 9813 (pool-2-thread-1), pid 9384 (live.bensonlive)
2020-10-17 13:16:20.063 9384-9806/com.live.bensonlive D/ACodec: dataspace changed to 0x10c10000 (R:2(Limited), P:3(BT601_6_625), M:3(BT601_6), T:3(SMPTE170M)) (R:2(Limited), S:2(BT601_625), T:3(SMPTE_170M))
2020-10-17 13:16:20.142 9384-9804/com.live.bensonlive D/RESLog: VideoSenderThread,MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:{max-bitrate=500000, csd-1=java.nio.HeapByteBuffer[pos=0 lim=9 cap=9], color-transfer=3, mime=video/avc, width=1280, bitrate=500000, color-range=2, frame-rate=30, color-standard=2, height=720, csd-0=java.nio.HeapByteBuffer[pos=0 lim=22 cap=22]}
2020-10-17 13:16:20.143 9384-9804/com.live.bensonlive D/RESLog: VideoSenderThread,MediaCode,eobIndex=0
2020-10-17 13:16:20.144 9384-9804/com.live.bensonlive D/RESLog: VideoSenderThread,MediaCode,eobIndex=1
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: Build fingerprint: 'vivo/PD1824/PD1824:10/QP1A.190711.020/compiler06021658:user/release-keys'
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: Revision: '0'
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: ABI: 'arm'
2020-10-17 13:16:20.144 9384-9804/com.live.bensonlive D/RESLog: VideoSenderThread,MediaCode,eobIndex=2
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: Timestamp: 2020-10-17 13:16:20+0800
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: pid: 9384, tid: 9813, name: pool-2-thread-1 >>> com.live.bensonlive <<<
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: uid: 10632
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: Cause: null pointer dereference
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: r0 00000000 r1 00000003 r2 00000001 r3 aa9b941b
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: r4 de3f9e20 r5 de3f9e20 r6 cffd28e4 r7 b83f4568
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: r8 00000000 r9 e31bc000 r10 b83f56a0 r11 e31bc000
2020-10-17 13:16:20.144 9820-9820/? A/DEBUG: ip bad31e40 sp b83f4480 lr bad23e37 pc bad25d56

第二个:

2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: backtrace:
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #00 pc 00007d56 /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/lib/arm/libnativepush.so (RTMP_SendPacket+30) (BuildId: a8a94f8d82441037f18d111231dd3b2cf2d431ab)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #1 pc 00005e33 /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/lib/arm/libnativepush.so (BuildId: a8a94f8d82441037f18d111231dd3b2cf2d431ab)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #2 pc 00005489 /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/lib/arm/libnativepush.so (RTMP_Connect1+200) (BuildId: a8a94f8d82441037f18d111231dd3b2cf2d431ab)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #3 pc 00005f75 /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/lib/arm/libnativepush.so (RTMP_Connect+224) (BuildId: a8a94f8d82441037f18d111231dd3b2cf2d431ab)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #4 pc 00003dc7 /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/lib/arm/libnativepush.so (Java_com_live_bensonlive_rtmp_RtmpClient_open+182) (BuildId: a8a94f8d82441037f18d111231dd3b2cf2d431ab)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #5 pc 000dc519 /apex/com.android.runtime/lib/libart.so (art_quick_generic_jni_trampoline+40) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #6 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #7 pc 0043d8ef /apex/com.android.runtime/lib/libart.so (art_quick_invoke_static_stub+246) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #8 pc 000dff95 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+188) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #9 pc 0021541b /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+270) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #10 pc 0021160f /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+738) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #11 pc 004350df /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+326) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.300 9820-9820/? A/DEBUG: #12 pc 000d2994 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+20) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #13 pc 000205be [anon:dalvik-classes2.dex extracted in memory from /data/app/com.live.bensonlive-D40bZzhz4s9oVyVjq9ZS0Q==/base.apk!classes2.dex] (com.live.bensonlive.task.RtmpStreamingSender.run+514)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #14 pc 004342cd /apex/com.android.runtime/lib/libart.so (MterpInvokeInterface+1536) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #15 pc 000d2a14 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_interface+20) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #16 pc 001f9386 /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor.runWorker+158)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #17 pc 00432dc7 /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1226) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #18 pc 000d2814 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+20) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #19 pc 001f8134 /apex/com.android.runtime/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor$Worker.run+4)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #20 pc 004342cd /apex/com.android.runtime/lib/libart.so (MterpInvokeInterface+1536) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #21 pc 000d2a14 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_interface+20) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #22 pc 000ebcec /apex/com.android.runtime/javalib/core-oj.jar (java.lang.Thread.run+8)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #23 pc 001f1437 /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.8262745575912663356+166) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #24 pc 001f5e4b /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+122) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #25 pc 00427237 /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+866) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #26 pc 000dc5a1 /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+32) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #27 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #28 pc 0043d7dd /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+248) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #29 pc 000dff81 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+168) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #30 pc 0037db07 /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+54) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #31 pc 0037e89b /apex/com.android.runtime/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+302) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #32 pc 003b04ff /apex/com.android.runtime/lib/libart.so (art::Thread::CreateCallback(void*)+1018) (BuildId: 2ff4f6f94904c73bffa436b4a90bb11e)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #33 pc 000a1b6d /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: 0e9304f4224fa907367550721e9004f2)
2020-10-17 13:16:20.301 9820-9820/? A/DEBUG: #34 pc 000582a9 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: 0e9304f4224fa907367550721e9004f2)

arm64架构支持

编译成功支持arm64的.so库在调用RTMP_Close()会报fatal signal之类的错误。有什么解决办法吗?
我发现这个库LibRtmp-Client-for-Android支持arm64的,能指点一下如何替换这个库吗?

无法运行

java.lang.IllegalStateException
03-01 02:49:18.435 5733-5843/net.yrom.screenrecorder W/System.err: at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
03-01 02:49:18.435 5733-5843/net.yrom.screenrecorder W/System.err: at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1033)
03-01 02:49:18.435 5733-5843/net.yrom.screenrecorder W/System.err: at net.yrom.screenrecorder.ScreenRecorder.recordVirtualDisplay(ScreenRecorder.java:108)
03-01 02:49:18.435 5733-5843/net.yrom.screenrecorder W/System.err: at net.yrom.screenrecorder.ScreenRecorder.run(ScreenRecorder.java:97)

大佬 我启动之后开启录屏 提示 E/AndroidRuntime: FATAL EXCEPTION: AudioSenderThread 能告诉我怎么解决吗谢谢

E/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
W/ACodec: do not know color format 0x7fa30c04 = 2141391876
W/ACodec: do not know color format 0x7f000789 = 2130708361
W/ACodec: do not know color format 0x7f000789 = 2130708361
W/IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
W/System.err: java.lang.IllegalStateException: Deque

  • full

E/AndroidRuntime: FATAL EXCEPTION: AudioSenderThread
Process: net.yrom.screenrecorder, PID: 22898
java.lang.IllegalStateException: Deque full
at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:306)
at java.util.concurrent.LinkedBlockingDeque.add(LinkedBlockingDeque.java:604)
at net.yrom.screenrecorder.task.RtmpStreamingSender.sendFood(RtmpStreamingSender.java:139)
at net.yrom.screenrecorder.ui.activity.ScreenRecordActivity$2.collect(ScreenRecordActivity.java:112)
at net.yrom.screenrecorder.task.AudioSenderThread.sendRealData(AudioSenderThread.java:112)
at net.yrom.screenrecorder.task.AudioSenderThread.run(AudioSenderThread.java:70)
W/System.err: at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:306)
W/System.err: at java.util.concurrent.LinkedBlockingDeque.add(LinkedBlockingDeque.java:604)
at net.yrom.screenrecorder.task.RtmpStreamingSender.sendFood(RtmpStreamingSender.java:139)
W/System.err: at net.yrom.screenrecorder.ui.activity.ScreenRecordActivity$2.collect(ScreenRecordActivity.java:112)
at net.yrom.screenrecorder.task.ScreenRecorder.sendRealData(ScreenRecorder.java:221)
W/System.err: at net.yrom.screenrecorder.task.ScreenRecorder.recordVirtualDisplay(ScreenRecorder.java:147)
W/System.err: at net.yrom.screenrecorder.task.ScreenRecorder.run(ScreenRecorder.java:95)

在同屏过程中,偶尔会出现队列已满的错误...

07-11 12:11:25.336 15194-19178/net.yrom.screenrecorder W/System.err: java.lang.IllegalStateException: Deque full
07-11 12:11:25.337 15194-19178/net.yrom.screenrecorder W/System.err: at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:335)
at java.util.concurrent.LinkedBlockingDeque.add(LinkedBlockingDeque.java:633)
at com.wd.screenrecorderlib.task.RtmpStreamingSender.sendFood(RtmpStreamingSender.java:140)
at net.yrom.screenrecorder.ui.activity.ScreenRecordActivity$2.collect(ScreenRecordActivity.java:111)
07-11 12:11:25.338 15194-19178/net.yrom.screenrecorder W/System.err: at com.wd.screenrecorderlib.task.ScreenRecorder.sendRealData(ScreenRecorder.java:233)
at com.wd.screenrecorderlib.task.ScreenRecorder.recordVirtualDisplay(ScreenRecorder.java:154)
at com.wd.screenrecorderlib.task.ScreenRecorder.run(ScreenRecorder.java:101)

镜头推流直接崩溃!

华为荣耀30S手机, 安卓10,
屏幕推流成功了,然后测试镜头推流,直接崩了,异常如下:

E/ACodec: [OMX.hisi.video.encoder.avc] configureCodec returning error -22
signalError(omxError 0x80001001, internalError -22)
E/MediaCodec: Codec reported err 0xffffffea, actionCode 0, while in state 3
E/MediaCodec: configure failed with err 0xffffffea, resetting...

E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.yrom.screenrecorder, PID: 31907
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.yrom.screenrecorder/net.yrom.screenrecorder.ui.activity.CameraActivity}: java.lang.IllegalArgumentException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3863)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4042)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2450)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8285)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
Caused by: java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2023)
at android.media.MediaCodec.configure(MediaCodec.java:1951)
at net.yrom.screenrecorder.ui.activity.CameraActivity.prepareEncoder(CameraActivity.java:138)
at net.yrom.screenrecorder.ui.activity.CameraActivity.onCreate(CameraActivity.java:89)
at android.app.Activity.performCreate(Activity.java:8085)
at android.app.Activity.performCreate(Activity.java:8073)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3836)

请问怎么解决?
谢谢!

可以修改推流的分辨率吗

现在是比较清晰,想修改分辨率,因为不需要那么清晰,想减少中间的传输,目前从代码中没找到要怎么设置的啊

找不到so库screenrecorderrtmp

public class MyApplication extends Application {

static {
    System.loadLibrary("screenrecorderrtmp");  //这句崩溃
}

。。。。。。

E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.yrom.screenrecorder, PID: 25404
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/net.yrom.screenrecorder-4jz3F0VzLIiOI6jt-W4BQw==/base.apk"],nativeLibraryDirectories=[/data/app/net.yrom.screenrecorder-4jz3F0VzLIiOI6jt-W4BQw==/lib/arm64, /system/lib64, /hw_product/lib64, /system/product/lib64]]] couldn't find "libscreenrecorderrtmp.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1668)
at net.yrom.screenrecorder.application.MyApplication.(MyApplication.java:15)
at java.lang.Class.newInstance(Native Method)

搜索文件夹发现文件libscreenrecorderrtmp.so存在,但是android-studio启动调试就报找不到文件
请问这个怎么折腾?

Crash on demo

  1. crash log
  java.lang.IllegalStateException: Deque full
                                                                             at java.util.concurrent.LinkedBlockingDeque.addLast(LinkedBlockingDeque.java:306)
                                                                             at java.util.concurrent.LinkedBlockingDeque.add(LinkedBlockingDeque.java:604)
                                                                             at net.yrom.screenrecorder.task.RtmpStreamingSender.sendFood(RtmpStreamingSender.java:139)
                                                                             at net.yrom.screenrecorder.ui.activity.ScreenRecordActivity$2.collect(ScreenRecordActivity.java:112)
                                                                             at net.yrom.screenrecorder.task.AudioSenderThread.sendRealData(AudioSenderThread.java:112)
                                                                             at net.yrom.screenrecorder.task.AudioSenderThread.run(AudioSenderThread.java:70)
  1. Could you help me to start a server?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.