pinkfish / flutter_rtmppublisher

Publisher to rtmp using the camera plugin as a basis to do all the basic camera/record management.
BSD 3-Clause "New" or "Revised" License
95 stars 121 forks source link

Android: Camera freezes on launch. #6

Closed ollyde closed 4 years ago

ollyde commented 4 years ago

We're getting so close!

On Android, the camera freezes on the first frame.

Current error logs.

The relevant error-causing widget was
    CameraStreamView 
lib/…/screens_requestival_streaming/live_stream_body.dart:99
When the exception was thrown, this was the stack
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)
#1      _CameraStreamViewState._body 
package:Requestival/…/screens_requestival_streaming/camera_stream_view.dart:94
#2      _CameraStreamViewState.build 
package:Requestival/…/screens_requestival_streaming/camera_stream_view.dart:49
#3      StatefulElement.build 
package:flutter/…/widgets/framework.dart:4619
#4      ComponentElement.performRebuild 
package:flutter/…/widgets/framework.dart:4502
...
════════════════════════════════════════════════════════════════════════════════
E/BufferQueueConsumer(10761): disconnect by : com.polydelic.myapp my_pid = 10761
E/BufferQueueConsumer(10761): disconnect by : com.polydelic.myapp my_pid = 10761
I/MicrophoneManager(10761): Microphone stopped
I/VideoEncoder(10761): stopped
I/AudioEncoder(10761): stopped
E/SensorManager(10761): registerListenerImpl sensorName:lsm6ds3c Accelerometer Non-wakeup,isWakeUpSensor:false,callingApp: com.polydelic.myapp,callingPid:10761,callingUid:10016
E/libc    (10761): Access denied finding property "persist.vendor.camera.privapp.list"
W/elic.myapp(10761): type=1400 audit(0.0:803): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=22857 scontext=u:r:untrusted_app_27:s0:c16,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0

I/Stuff   (10761): {textureId=3, url=rtmps://global-live.mux.com:443/app/00463915-10fe-08b0-3138-f71608eb7d57}
I/MicrophoneManager(10761): Microphone created, 32000hz, Stereo
D/MediaCodec(10761):  name = c2.android.aac.encoder
D/CCodec  (10761): allocate(c2.android.aac.encoder)
I/CCodec  (10761): Created component [c2.android.aac.encoder]
D/CCodecConfig(10761): read media type: audio/mp4a-latm
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater(10761): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig(10761): query failed after returning 9 values (BAD_INDEX)
D/CCodecConfig(10761): c2 config is Dict {
D/CCodecConfig(10761):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig(10761):   c2::u32 coded.pl.level = 0
D/CCodecConfig(10761):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig(10761):   c2::u32 coding.aac-sbr-mode.value = 3
D/CCodecConfig(10761):   c2::u32 input.buffers.max-size.value = 2048
D/CCodecConfig(10761):   c2::u32 input.delay.value = 0
D/CCodecConfig(10761):   string input.media-type.value = "audio/raw"
D/CCodecConfig(10761):   string output.media-type.value = "audio/mp4a-latm"
D/CCodecConfig(10761):   c2::u32 raw.channel-count.value = 1
D/CCodecConfig(10761):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig(10761): }

W/MediaCodec(10761): RETYR:0
D/CCodecConfig(10761): no c2 equivalents for aac-profile
D/CCodecConfig(10761): no c2 equivalents for encoder
D/CCodecConfig(10761): c2 config is Dict {
D/CCodecConfig(10761):   c2::u32 coded.bitrate.value = 65536
D/CCodecConfig(10761):   c2::u32 coded.pl.level = 0
D/CCodecConfig(10761):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig(10761):   c2::u32 coding.aac-sbr-mode.value = 3
D/CCodecConfig(10761):   c2::u32 input.buffers.max-size.value = 4096
D/CCodecConfig(10761):   c2::u32 input.delay.value = 0
D/CCodecConfig(10761):   string input.media-type.value = "audio/raw"
D/CCodecConfig(10761):   string output.media-type.value = "audio/mp4a-latm"
D/CCodecConfig(10761):   c2::u32 raw.channel-count.value = 2
D/CCodecConfig(10761):   c2::u32 raw.sample-rate.value = 32000
D/CCodecConfig(10761): }
W/Codec2Client(10761): query -- param skipped: index = 1107298332.
D/CCodec  (10761): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  (10761):   int32_t channel-count = 2
D/CCodec  (10761):   int32_t max-input-size = 4096
D/CCodec  (10761):   string mime = "audio/raw"
D/CCodec  (10761):   int32_t sample-rate = 32000
D/CCodec  (10761): } and output: AMessage(what = 0x00000000) = {
D/CCodec  (10761):   int32_t bitrate = 65536
D/CCodec  (10761):   int32_t channel-count = 2
D/CCodec  (10761):   int32_t level = 0
D/CCodec  (10761):   int32_t max-bitrate = 65536
D/CCodec  (10761):   string mime = "audio/mp4a-latm"
D/CCodec  (10761):   int32_t profile = 2
D/CCodec  (10761):   int32_t sample-rate = 32000
D/CCodec  (10761): }

I/AudioEncoder(10761): prepared
I/VideoEncoder(10761): VideoEncoder OMX.qcom.video.encoder.avc
I/VideoEncoder(10761): Color supported: 2141391878
I/VideoEncoder(10761): Color supported: 2141391876
I/VideoEncoder(10761): Color supported: 2141391872
I/VideoEncoder(10761): Color supported: 2141391881
I/VideoEncoder(10761): Color supported: 2141391882
I/VideoEncoder(10761): Color supported: 2141391880
I/VideoEncoder(10761): Color supported: 2141391879
I/VideoEncoder(10761): Color supported: 2130708361
D/MediaCodec(10761):  name = OMX.qcom.video.encoder.avc
I/OMXClient(10761): IOmx service obtained
I/VideoEncoder(10761): Prepare video info: SURFACE, 480x720
W/MediaCodec(10761): RETYR:0
I/ExtendedACodec(10761): setupVideoEncoder()
W/OMXUtils(10761): do not know color format 0x7fa30c06 = 2141391878
W/OMXUtils(10761): do not know color format 0x7fa30c04 = 2141391876
W/OMXUtils(10761): do not know color format 0x7fa30c00 = 2141391872
W/OMXUtils(10761): do not know color format 0x7fa30c09 = 2141391881
W/OMXUtils(10761): do not know color format 0x7fa30c0a = 2141391882
W/OMXUtils(10761): do not know color format 0x7fa30c08 = 2141391880
W/OMXUtils(10761): do not know color format 0x7fa30c07 = 2141391879
W/OMXUtils(10761): do not know color format 0x7f000789 = 2130708361
I/ACodec  (10761): setupAVCEncoderParameters: Open /proc/10761/comm succeed
I/ACodec  (10761): setupAVCEncoderParameters: Get package name: elic.myapp
I/ACodec  (10761): setupAVCEncoderParameters with [profile: High] [level: Level1]
I/ACodec  (10761): setupAVCEncoderParameters: AVC codec setting: 480 x 720 bitrate: 1228800, P-frame: 59, B-frame: 0, fps: 30.000000
I/ACodec  (10761): [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
I/ACodec  (10761): setupVideoEncoder succeeded
I/ExtendedACodec(10761): [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 23) = {
I/ExtendedACodec(10761):   int32_t color-format = 2130708361
I/ExtendedACodec(10761):   int32_t i-frame-interval = 2
I/ExtendedACodec(10761):   string mime = "video/avc"
I/ExtendedACodec(10761):   int32_t width = 480
I/ExtendedACodec(10761):   int32_t bitrate = 1228800
I/ExtendedACodec(10761):   int32_t max-input-size = 0
I/ExtendedACodec(10761):   int32_t frame-rate = 30
I/ExtendedACodec(10761):   int32_t height = 720
I/ExtendedACodec(10761):   int32_t encoder = 1
I/ExtendedACodec(10761): }
W/OMXUtils(10761): do not know color format 0x7f000789 = 2130708361
I/VideoEncoder(10761): prepared
W/CameraDevice-JV-1(10761): Stream configuration failed due to: endConfigure:508: Camera 1: Unsupported set of inputs/outputs provided
E/CameraCaptureSession(10761): Session 1: Failed to create capture session; configuration failed
D/OnePlusJankManager(10761):  Chor uploadMDM JANK_TYPE_ONCE mViewTitle = com.polydelic.myapp/com.polydelic.myapp.MainActivity--- jank level = 1

I/flutter (10761): Event {errorDescription: Failed to configure camera session., eventType: error}
E/flutter (10761): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method stopVideoStreaming on channel plugins.flutter.io/camera_with_rtmp)
adorufus commented 4 years ago

any workaround on this issue? cause i have same problem

pinkfish commented 4 years ago

Working on it. Not fixed yet.

On Sun, May 17, 2020, 5:48 AM Oktaviano Fahdi Syaputra < notifications@github.com> wrote:

any workaround on this issue? cause i have same problem

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pinkfish/flutter_rtmppublisher/issues/6#issuecomment-629791532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATOMMJYQAZQYIHBXB4HFVTRR7MKFANCNFSM4NASRNRA .

ollyde commented 4 years ago

@pinkfish also working on it, let you know if we get a fix.

pinkfish commented 4 years ago

Not sure on the issue, I did discover things don't work at all in the emulator :)

Once I got onto my phone it was finding the packets correctly, but the encoder failed to setup correctly so it didn't seem to be sending anything. I think I messed up something else... The setup all looks correct though, so not sure why it is failing there.

Thanks!

On Mon, 18 May 2020 at 03:06, Oliver Dixon notifications@github.com wrote:

@pinkfish https://github.com/pinkfish also working on it, let you know if we get a fix.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pinkfish/flutter_rtmppublisher/issues/6#issuecomment-630082811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATOMMNSYPRW3ZHD74ZUEEDRSECDVANCNFSM4NASRNRA .

pinkfish commented 4 years ago

Tracked this down. Had the wrong orientation for the camera feed when setting up the surface. Right now this does mean it broadcasts always in landscape mode :). Need to work out how to handle that part. However it does product an output now.

pinkfish commented 4 years ago

Updated to 0.1.6