Android MediaPlayer 延迟表面绘制导致视频不同步
我使用 android 教程 此处。我从我想玩的两种不同格式中得到了不同的行为。第一种类型(youtube lq 3gp)运行良好。第二种类型(youtube hq mp4)将在 TIOverlay 函数运行之前开始播放音频(因此没有视频),然后一旦绘制视频,它就会与音频不同步。我知道我的手机支持 hq mp4 格式,因为它是移动 YouTube 网站播放的类型,运行良好。有关格式的更多信息,请点击此处。
所以我想我要么需要一种方法来强制 TIOverlay 运行,要么需要一种方法来监听它是否准备好,并且在此之前不要启动视频。下面的一些 logcat 输出显示了流程,在这两种情况下调用 onPrepared() 时很有趣。 3gp 似乎在 onPrepared() 之前和之后执行 TIOverlay 调用,而 mp4 仅在之后执行。
编辑:相同的代码似乎可以在 Motorola Droid 3 上运行。不过,如果该视频格式可以在我的 Droid 1 上的 youtube 上运行,我觉得它也应该在我的应用程序中运行。 我尝试等待播放视频,直到它稍微缓冲一下。这不仅没有解决问题,而且在视频开始时缓冲区也重新启动。
3GP:
10-25 16:56:26.750: DEBUG/TIOverlay(1103): overlay_createOverlay:IN w=176 h=144 format=22
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=480 h=854
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=176 h=144
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=176 h=144
10-25 16:56:26.961: INFO/Overlay(1103): 8 buffers allocated 4 requested
10-25 16:56:26.961: INFO/Overlay(1103): buffer cookie is 2
10-25 16:56:26.961: INFO/TIOverlay(1103): Opened video1/fd=138/obj=003a2160/shm=135/size=4096
10-25 16:56:26.961: DEBUG/TIOverlay(1103): overlay_createOverlay: OUT
10-25 16:56:26.961: INFO/TIOverlay(1103): Nothing to do!
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/0/addr=4140a000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/1/addr=41417000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/2/addr=41424000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/3/addr=41431000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/4/addr=4143e000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/5/addr=4144b000/len=53248
10-25 16:56:26.977: DEBUG/TI_Video_Decoder(1014): VIDDEC_SendCommand: Received request from omx client to change state to 2
10-25 16:56:26.985: DEBUG/TI_Video_Decoder(1014): Handle request for state transition: 1 => OMX_StateIdle
10-25 16:56:26.985: DEBUG/d(2220): videosizechanged()
10-25 16:56:27.102: DEBUG/TI_Video_Decoder(1014): OMX_StateIdle state reached
10-25 16:56:27.305: INFO/PlayerDriver(1014): buffering (15)
10-25 16:56:28.235: DEBUG/TI_Video_Decoder(1014): VIDDEC_SendCommand: Received request from omx client to change state to 3
10-25 16:56:28.243: WARN/MediaPlayer(2220): info/warning (1, 44)
10-25 16:56:28.258: INFO/MediaPlayer(2220): Info (1,44)
10-25 16:56:28.258: DEBUG/d(2220): onPrepared()
10-25 16:56:28.282: VERBOSE/BufferAllocOmap34xx(1014): BufferAllocOmap34xx::removeRef()
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): 8 buffers allocated 4 requested
10-25 16:56:28.290: INFO/Overlay(1014): buffer cookie is 2
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:56:28.297: INFO/TIOverlay(1014): Postponing Stream Enable/1/0
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/0/addr=4140a000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/1/addr=41417000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/2/addr=41424000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/3/addr=41431000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/4/addr=4143e000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/5/addr=4144b000/len=53248
10-25 16:56:28.891: DEBUG/dalvikvm(2050): GC_EXPLICIT freed 2271 objects / 138840 bytes in 229ms
10-25 16:56:28.966: INFO/PlayerDriver(1014): buffering (15)
10-25 16:56:29.930: WARN/MediaPlayer(2220): info/warning (1, 44)
10-25 16:56:30.258: INFO/TIOverlay(1103): Position/X0/Y0/W0/H0
10-25 16:56:30.258: INFO/TIOverlay(1103): Adjusted Position/X0/Y200/W480/H0
10-25 16:56:30.258: INFO/TIOverlay(1103): Rotation/0
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=854
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=392
10-25 16:56:30.266: INFO/Overlay(1103): dumping driver state:
10-25 16:56:30.266: INFO/Overlay(1103): output pixfmt:
10-25 16:56:30.266: INFO/Overlay(1103): w: 176
10-25 16:56:30.266: INFO/Overlay(1103): h: 144
10-25 16:56:30.266: INFO/Overlay(1103): color: 7
10-25 16:56:30.266: INFO/Overlay(1103): UYVY
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay window:
10-25 16:56:30.266: INFO/Overlay(1103): window l: 0
10-25 16:56:30.266: INFO/Overlay(1103): window t: 200
10-25 16:56:30.266: INFO/Overlay(1103): window w: 480
10-25 16:56:30.266: INFO/Overlay(1103): window h: 392
10-25 16:56:30.266: INFO/Overlay(1103): output crop:
10-25 16:56:30.266: INFO/Overlay(1103): crop l: 0
10-25 16:56:30.266: INFO/Overlay(1103): crop t: 0
10-25 16:56:30.266: INFO/Overlay(1103): crop w: 176
10-25 16:56:30.266: INFO/Overlay(1103): crop h: 144
10-25 16:56:30.274: DEBUG/d(2220): surfaceChanged()
10-25 16:56:30.297: DEBUG/d(2220): videosizechanged()
MP4:
10-25 16:51:57.454: DEBUG/d(2071): onPrepared()
10-25 16:51:58.360: DEBUG/d(2071): surfaceChanged()
10-25 16:52:02.219: DEBUG/TIOverlay(1103): overlay_createOverlay:IN w=640 h=360 format=22
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=480 h=854
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=640 h=360
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=640 h=360
10-25 16:52:02.243: INFO/Overlay(1103): 8 buffers allocated 4 requested
10-25 16:52:02.243: INFO/Overlay(1103): buffer cookie is 2
10-25 16:52:02.250: INFO/TIOverlay(1103): Opened video1/fd=139/obj=00501e18/shm=108/size=4096
10-25 16:52:02.250: DEBUG/TIOverlay(1103): overlay_createOverlay: OUT
10-25 16:52:02.250: INFO/TIOverlay(1103): Position/X0/Y0/W0/H0
10-25 16:52:02.250: INFO/TIOverlay(1103): Adjusted Position/X0/Y200/W480/H0
10-25 16:52:02.250: INFO/TIOverlay(1103): Rotation/0
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=854
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=270
10-25 16:52:02.250: INFO/Overlay(1103): dumping driver state:
10-25 16:52:02.250: INFO/Overlay(1103): output pixfmt:
10-25 16:52:02.250: INFO/Overlay(1103): w: 640
10-25 16:52:02.250: INFO/Overlay(1103): h: 360
10-25 16:52:02.250: INFO/Overlay(1103): color: 7
10-25 16:52:02.250: INFO/Overlay(1103): UYVY
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay window:
10-25 16:52:02.250: INFO/Overlay(1103): window l: 0
10-25 16:52:02.250: INFO/Overlay(1103): window t: 200
10-25 16:52:02.250: INFO/Overlay(1103): window w: 480
10-25 16:52:02.250: INFO/Overlay(1103): window h: 270
10-25 16:52:02.250: INFO/Overlay(1103): output crop:
10-25 16:52:02.250: INFO/Overlay(1103): crop l: 0
10-25 16:52:02.250: INFO/Overlay(1103): crop t: 0
10-25 16:52:02.250: INFO/Overlay(1103): crop w: 640
10-25 16:52:02.250: INFO/Overlay(1103): crop h: 360
10-25 16:52:02.250: INFO/TIOverlay(1103): Postponing Stream Enable/1/0
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/0/addr=420f1000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/1/addr=4269d000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/2/addr=4270e000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/3/addr=4277f000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/4/addr=427f0000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/5/addr=42861000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/6/addr=428d2000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:52:02.289: INFO/TIOverlay(1014): Buffer/7/addr=42943000/len=462848
I'm streaming video to my Motorola Droid 1 using the method from the android tutorial here. I'm getting different behavior from the two different formats I'd like to play. The first type (youtube lq 3gp) plays fine. The second type (youtube hq mp4) will start to play the audio before the TIOverlay functions are run (so no video), then once the video is drawn it's out of sync with the audio. I know the hq mp4 format is supported by my phone because it is the type played by the mobile youtube site which works fine. More info on the formats here.
So I guess I either need a way to force the TIOverlay to run, or a way to listen for it to be ready and not to start the video until that point. Some logcat output below shows the flow, it's interesting when onPrepared() is called in both cases. The 3gp seems to do TIOverlay calls before and after onPrepared(), while the mp4 only does them after.
Edit: The same code seems to be working on a Motorola Droid 3. Still, if that video format works on youtube on my Droid 1, I feel like it should work in my app as well.
I tried waiting to play the video until it was buffered a little bit. Not only did this not solve the problem, but the buffer also restarted upon starting the video.
3GP:
10-25 16:56:26.750: DEBUG/TIOverlay(1103): overlay_createOverlay:IN w=176 h=144 format=22
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=480 h=854
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=176 h=144
10-25 16:56:26.946: INFO/Overlay(1103): v4l2_overlay_init:: w=176 h=144
10-25 16:56:26.961: INFO/Overlay(1103): 8 buffers allocated 4 requested
10-25 16:56:26.961: INFO/Overlay(1103): buffer cookie is 2
10-25 16:56:26.961: INFO/TIOverlay(1103): Opened video1/fd=138/obj=003a2160/shm=135/size=4096
10-25 16:56:26.961: DEBUG/TIOverlay(1103): overlay_createOverlay: OUT
10-25 16:56:26.961: INFO/TIOverlay(1103): Nothing to do!
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/0/addr=4140a000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/1/addr=41417000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/2/addr=41424000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/3/addr=41431000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/4/addr=4143e000/len=53248
10-25 16:56:26.969: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:26.969: INFO/TIOverlay(1014): Buffer/5/addr=4144b000/len=53248
10-25 16:56:26.977: DEBUG/TI_Video_Decoder(1014): VIDDEC_SendCommand: Received request from omx client to change state to 2
10-25 16:56:26.985: DEBUG/TI_Video_Decoder(1014): Handle request for state transition: 1 => OMX_StateIdle
10-25 16:56:26.985: DEBUG/d(2220): videosizechanged()
10-25 16:56:27.102: DEBUG/TI_Video_Decoder(1014): OMX_StateIdle state reached
10-25 16:56:27.305: INFO/PlayerDriver(1014): buffering (15)
10-25 16:56:28.235: DEBUG/TI_Video_Decoder(1014): VIDDEC_SendCommand: Received request from omx client to change state to 3
10-25 16:56:28.243: WARN/MediaPlayer(2220): info/warning (1, 44)
10-25 16:56:28.258: INFO/MediaPlayer(2220): Info (1,44)
10-25 16:56:28.258: DEBUG/d(2220): onPrepared()
10-25 16:56:28.282: VERBOSE/BufferAllocOmap34xx(1014): BufferAllocOmap34xx::removeRef()
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): v4l2_overlay_init:: w=176 h=144
10-25 16:56:28.290: INFO/Overlay(1014): 8 buffers allocated 4 requested
10-25 16:56:28.290: INFO/Overlay(1014): buffer cookie is 2
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:56:28.290: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:56:28.297: INFO/TIOverlay(1014): Postponing Stream Enable/1/0
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/0/addr=4140a000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/1/addr=41417000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/2/addr=41424000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/3/addr=41431000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/4/addr=4143e000/len=53248
10-25 16:56:28.297: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:56:28.297: INFO/TIOverlay(1014): Buffer/5/addr=4144b000/len=53248
10-25 16:56:28.891: DEBUG/dalvikvm(2050): GC_EXPLICIT freed 2271 objects / 138840 bytes in 229ms
10-25 16:56:28.966: INFO/PlayerDriver(1014): buffering (15)
10-25 16:56:29.930: WARN/MediaPlayer(2220): info/warning (1, 44)
10-25 16:56:30.258: INFO/TIOverlay(1103): Position/X0/Y0/W0/H0
10-25 16:56:30.258: INFO/TIOverlay(1103): Adjusted Position/X0/Y200/W480/H0
10-25 16:56:30.258: INFO/TIOverlay(1103): Rotation/0
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=854
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=392
10-25 16:56:30.266: INFO/Overlay(1103): dumping driver state:
10-25 16:56:30.266: INFO/Overlay(1103): output pixfmt:
10-25 16:56:30.266: INFO/Overlay(1103): w: 176
10-25 16:56:30.266: INFO/Overlay(1103): h: 144
10-25 16:56:30.266: INFO/Overlay(1103): color: 7
10-25 16:56:30.266: INFO/Overlay(1103): UYVY
10-25 16:56:30.266: INFO/Overlay(1103): v4l2_overlay window:
10-25 16:56:30.266: INFO/Overlay(1103): window l: 0
10-25 16:56:30.266: INFO/Overlay(1103): window t: 200
10-25 16:56:30.266: INFO/Overlay(1103): window w: 480
10-25 16:56:30.266: INFO/Overlay(1103): window h: 392
10-25 16:56:30.266: INFO/Overlay(1103): output crop:
10-25 16:56:30.266: INFO/Overlay(1103): crop l: 0
10-25 16:56:30.266: INFO/Overlay(1103): crop t: 0
10-25 16:56:30.266: INFO/Overlay(1103): crop w: 176
10-25 16:56:30.266: INFO/Overlay(1103): crop h: 144
10-25 16:56:30.274: DEBUG/d(2220): surfaceChanged()
10-25 16:56:30.297: DEBUG/d(2220): videosizechanged()
MP4:
10-25 16:51:57.454: DEBUG/d(2071): onPrepared()
10-25 16:51:58.360: DEBUG/d(2071): surfaceChanged()
10-25 16:52:02.219: DEBUG/TIOverlay(1103): overlay_createOverlay:IN w=640 h=360 format=22
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=480 h=854
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=640 h=360
10-25 16:52:02.219: INFO/Overlay(1103): v4l2_overlay_init:: w=640 h=360
10-25 16:52:02.243: INFO/Overlay(1103): 8 buffers allocated 4 requested
10-25 16:52:02.243: INFO/Overlay(1103): buffer cookie is 2
10-25 16:52:02.250: INFO/TIOverlay(1103): Opened video1/fd=139/obj=00501e18/shm=108/size=4096
10-25 16:52:02.250: DEBUG/TIOverlay(1103): overlay_createOverlay: OUT
10-25 16:52:02.250: INFO/TIOverlay(1103): Position/X0/Y0/W0/H0
10-25 16:52:02.250: INFO/TIOverlay(1103): Adjusted Position/X0/Y200/W480/H0
10-25 16:52:02.250: INFO/TIOverlay(1103): Rotation/0
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=854
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay_set_position:: w=480 h=270
10-25 16:52:02.250: INFO/Overlay(1103): dumping driver state:
10-25 16:52:02.250: INFO/Overlay(1103): output pixfmt:
10-25 16:52:02.250: INFO/Overlay(1103): w: 640
10-25 16:52:02.250: INFO/Overlay(1103): h: 360
10-25 16:52:02.250: INFO/Overlay(1103): color: 7
10-25 16:52:02.250: INFO/Overlay(1103): UYVY
10-25 16:52:02.250: INFO/Overlay(1103): v4l2_overlay window:
10-25 16:52:02.250: INFO/Overlay(1103): window l: 0
10-25 16:52:02.250: INFO/Overlay(1103): window t: 200
10-25 16:52:02.250: INFO/Overlay(1103): window w: 480
10-25 16:52:02.250: INFO/Overlay(1103): window h: 270
10-25 16:52:02.250: INFO/Overlay(1103): output crop:
10-25 16:52:02.250: INFO/Overlay(1103): crop l: 0
10-25 16:52:02.250: INFO/Overlay(1103): crop t: 0
10-25 16:52:02.250: INFO/Overlay(1103): crop w: 640
10-25 16:52:02.250: INFO/Overlay(1103): crop h: 360
10-25 16:52:02.250: INFO/TIOverlay(1103): Postponing Stream Enable/1/0
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:52:02.266: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:52:02.274: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=0
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/0/addr=420f1000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=1
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/1/addr=4269d000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=2
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/2/addr=4270e000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=3
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/3/addr=4277f000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=4
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/4/addr=427f0000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=5
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/5/addr=42861000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=6
10-25 16:52:02.282: INFO/TIOverlay(1014): Buffer/6/addr=428d2000/len=462848
10-25 16:52:02.282: INFO/Overlay(1014): query buffer, mem=1 type=2 index=7
10-25 16:52:02.289: INFO/TIOverlay(1014): Buffer/7/addr=42943000/len=462848
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我似乎已经解决了这个问题。我的方法是看看它是否以最简单的形式工作(复制 示例代码在android网站上),果然它做到了。然后我慢慢地将其构建为应用程序当前的功能,并且它仍然有效。不幸的是,我无法确定确切的原因,尽管在我的第一个实现中,我没有使用 Android 站点中的确切代码作为基础。似乎很多事情都可能导致此问题,包括在开始视频之前执行eekTo,仅举一例。对于其他遇到“音频但没有视频”错误的人,我建议采用这种从最简单的实现开始并进行备份的方法。
I seem to have fixed the problem. My approach was to see if it worked in its simplest form (copied the example code on the android site), and sure enough it did. I then slowly built it up to the apps current functionality and it still works. Unfortunately I couldn't determine the exact cause, although in my first implementation I didn't use the exact code from the android site as the base. It seems many things can cause this problem, including doing a seekTo before starting the video, to name just one. Anyone else experiencing the "audio but no video" bug, I recommend taking this approach of starting from its simplest implementation and working back up.