ksvc / KSYMediaPlayer_Android

金山云Android播放SDK(KSYUN Live Streaming player SDK),支持RTMP HTTP-FLV HLS 协议(supporting RTMP HTTP-FLV HLS protocol),直播延时2-3秒(Living delay 2 or 3 seconds),supporting jitter control,software&hardware decode
http://v.ksyun.com/
Apache License 2.0
854 stars 246 forks source link

从服务端给播放器输入流的数据量应该怎么设置 #116

Open wurq opened 7 years ago

wurq commented 7 years ago

从服务端给播放器输入流的数据量过大或者过小会怎么样? 目前看起来好像过大会掉帧

FirmianaRain commented 7 years ago

播放器是主动从服务器读取数据,过小会引起卡顿,读取的数据超过设置的阈值时,播放器会暂时停止读取数据 请问掉帧是什么情况下出现的呢

wurq commented 7 years ago

你好,多谢,不过我的实际情况是 getVideoDecodeFramesPerSecond 获得值一直是25不变的时候,返回的errcode是 (MEDIA_INFO_UNKNOWN 1 未指定的播放器信息) 而实际上这时候已经不能从网络获得返回流了 。

FirmianaRain commented 7 years ago
  1. 播放器本身会有缓存,解码线程会不断解码,返回errcode的线程与解码线程不是一个线程
  2. 现象似乎跟你描述的问题没什么关系
wurq commented 7 years ago

你好,我们现在的问题是: 播放器播放开始就缓存服务端的数据,待缓存满后,播放器就自己停止了请求视频流,直到缓存的数据播放完毕,也没有新的视频流请求,缓存播放完毕后播放器爆出 (MEDIA_ERROR_UNKNOWN 1 未知的播放器错误),备注:使用的版本是1.9.0。

FirmianaRain commented 7 years ago

是遇到错误了,然后未能读数据 麻烦能提供个测试地址吗

wurq commented 7 years ago

你好 目前是内部的测试地址。
在IMediaPlayer.OnBufferingUpdateListener这个接口的回调的log如下: 04-27 18:01:03.268 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 264019 getDownloadDataSize = 12841 videoBufferByteLength = 2210488 ,percent = 31 04-27 18:01:03.388 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 264151 getDownloadDataSize = 12843 videoBufferByteLength = 2211964 ,percent = 31 04-27 18:01:03.468 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 264237 getDownloadDataSize = 12851 videoBufferByteLength = 2209221 ,percent = 31 04-27 18:01:03.538 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 264293 getDownloadDataSize = 12851 videoBufferByteLength = 2208501 ,percent = 31 04-27 18:01:03.668 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 264430 getDownloadDataSize = 12854 videoBufferByteLength = 2210277 ,percent = 31 04-27 18:02:15.188 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336015 getDownloadDataSize = 12857 videoBufferByteLength = 4103 ,percent = 31 04-27 18:02:15.188 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336015 getDownloadDataSize = 12857 videoBufferByteLength = 4103 ,percent = 31 04-27 18:02:15.198 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336016 getDownloadDataSize = 12857 videoBufferByteLength = 4247 ,percent = 100 04-27 18:02:15.308 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336147 getDownloadDataSize = 12857 videoBufferByteLength = 0 ,percent = 100 04-27 18:02:15.418 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336260 getDownloadDataSize = 12857 videoBufferByteLength = 0 ,percent = 100 04-27 18:02:15.528 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336365 getDownloadDataSize = 12857 videoBufferByteLength = 0 ,percent = 100 04-27 18:02:15.638 1935-1935/com.opencourse D/tag-httpserver: CurrentPosition = 336478 getDownloadDataSize = 12857 videoBufferByteLength = 0 ,percent = 100 其中在charles中发现,在缓存达到预设缓存buff大小之后,就停止了网络请求,并且等到缓存buff的数据播放完成 就爆出错误。

wurq commented 7 years ago

04-27 20:54:08.008 30490-31648/com.opencourse D/auth: Signature = UT9Xh66+Sn1T4zzMTE2uDONqUog= 04-27 20:54:08.223 30490-31648/com.opencourse D/KSY_ANDROID_LOG: result = {"errmsg":"success","errno":0,"logcloud":0}/n

这是刚才的和sdk有关的log部分

FirmianaRain commented 7 years ago

从日志上看并没有什么问题 是播放什么视频呢

wurq commented 7 years ago

目前分析来看,播放器这边在播放缓存已满的情况下,再有新的response来时,整个线程会被阻塞。 直到新的缓存被释放时,新数据也没有被写入缓存中。

FirmianaRain commented 7 years ago
  1. 请问下这个结论是怎么得到的呢?
  2. 从原来的你提供的信息来看,问题应该是在播放过程中遇到错误,播放器会把当前已有的缓存播放完成之后发出onError回调,播放停止

建议提供下具体错误码以及播放地址由我们来分析下出错原因