Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m3u8下载,@Download.onTaskRunning 回调中的任务的getSpeed() 为0 ,1,并且getConvertSpeed()为1.0b/s #526

Closed
cblsyp opened this issue Nov 20, 2019 · 1 comment

Comments

@cblsyp
Copy link

@cblsyp cblsyp commented Nov 20, 2019

M3U8VodOption option = initOptions(taskUrl, size);

    long taskId = Aria.download(this)
            .load(url_path)
            .setExtendField(dataParams)
            .setFilePath(file_path, true)
            .m3u8VodOption(option)
            .create();




private M3U8VodOption initOptions(String taskUrl, long size) {
    M3U8VodOption option = new M3U8VodOption();
    option.setVodTsUrlConvert(new TneConcerter());
    /*option.setMergeHandler(new AiarConfigs.TsMergeHandler());*/
    option.setMaxTsQueueNum(10);
    option.merge(true);
    return option;
}

static class TneConcerter implements IVodTsUrlConverter {
private static final String TAG = "chen debug";

    @Override
    public List<String> convert(String m3u8Url, List<String> tsUrls) {
        Log.i(TAG, "convert: m3u8Url: " + m3u8Url);
        List<String> newUrl = new ArrayList<>();
        for (String url : tsUrls) {
            newUrl.add(getPath(m3u8Url, url));
        }
        for (String url : newUrl) {
            Log.i(TAG, "convert: 转换之后的url:  " + url);
        }
        return newUrl;
    }
}

private static String getPath(String url, String anchor) {
Log.i(TAG, "getPath: ");
HttpUrl httpUrl = HttpUrl.get(url);
String scheme = httpUrl.scheme();
String host = httpUrl.host();
int pathSize = httpUrl.pathSize();
List pathSegments = new ArrayList<>(10);
pathSegments = httpUrl.pathSegments();
List paths = new ArrayList<>(10);
StringBuilder newUrlBuilder = new StringBuilder();
newUrlBuilder.append(scheme).append("://").append(host).append("/");
for (int i = 0; i < pathSize - 1; i++) {
newUrlBuilder.append(pathSegments.get(i) + "/");
}
newUrlBuilder.append(anchor);
return newUrlBuilder.toString();
}

log:

W/RecordUtil: 修改任务记录失败,新文件路径和旧文件路径一致
2019-11-20 17:28:42.825 9018-9018/com.piglet I/CheckDEntityUtil: 将任务重命名为:50a700e22c933554b51d7b0fd2eeee4e.ts
2019-11-20 17:28:42.842 9018-9018/com.piglet W/CheckDEntityUtil: 由于m3u8协议的特殊性质,无法有效快速获取到正确到文件长度,如果你需要显示文件中长度,你需要自行设置文件长度:.asM3U8().asVod().setFileSize(xxx)
2019-11-20 17:28:42.848 9018-9311/com.piglet D/BaseCachePool: 任务【50a700e22c933554b51d7b0fd2eeee4e.ts】进入缓存队列成功
2019-11-20 17:28:42.848 9018-9311/com.piglet D/StartCmd: 开始新任务, 任务状态:3
2019-11-20 17:28:42.852 9018-9311/com.piglet D/BaseExecutePool: 任务【50a700e22c933554b51d7b0fd2eeee4e.ts】进入执行队列成功
2019-11-20 17:28:42.865 9018-9027/com.piglet W/System: A resource failed to call end.
2019-11-20 17:28:42.867 9018-9027/com.piglet I/chatty: uid=10230(com.piglet) FinalizerDaemon identical 2 lines
2019-11-20 17:28:42.867 9018-9027/com.piglet W/System: A resource failed to call end.
2019-11-20 17:28:42.869 9018-9312/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:42.869 9018-9312/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:42.974 9018-9313/com.piglet D/BaseCachePool: 任务【f53148ff4a947c8c8b62a15a49d0c73a.ts】进入缓存队列成功
2019-11-20 17:28:42.974 9018-9313/com.piglet D/BaseExecutePool: 任务【f53148ff4a947c8c8b62a15a49d0c73a.ts】进入执行队列成功
2019-11-20 17:28:42.980 9018-9313/com.piglet D/BaseCachePool: 任务【240a9a4534eea99df4690f41e9788502.ts】进入缓存队列成功
2019-11-20 17:28:42.980 9018-9313/com.piglet D/BaseExecutePool: 任务【240a9a4534eea99df4690f41e9788502.ts】进入执行队列成功
2019-11-20 17:28:42.982 9018-9316/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:42.982 9018-9316/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:42.985 9018-9313/com.piglet W/ResumeThread: 任务已存在
2019-11-20 17:28:42.987 9018-9317/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:42.987 9018-9317/com.piglet I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-11-20 17:28:43.043 9018-9317/com.piglet D/M3U8InfoThread: #EXT-X-VERSION:3
2019-11-20 17:28:43.043 9018-9317/com.piglet D/M3U8InfoThread: #EXT-X-MEDIA-SEQUENCE:0
2019-11-20 17:28:43.043 9018-9317/com.piglet D/M3U8InfoThread: #EXT-X-ALLOW-CACHE:YES
2019-11-20 17:28:43.043 9018-9317/com.piglet D/M3U8InfoThread: #EXT-X-TARGETDURATION:11
2019-11-20 17:28:43.043 9018-9317/com.piglet D/M3U8InfoThread: #EXTINF:1.084411,
2019-11-20 17:28:43.044 9018-9317/com.piglet D/M3U8InfoThread: 437d0010f92444ebb5912115094195ad_0000000.ts
2019-11-20 17:28:43.044 9018-9317/com.piglet D/M3U8InfoThread: #EXTINF:1.001000,
2019-11-20 17:28:43.044 9018-9317/com.piglet D/M3U8InfoThread: 437d0010f92444ebb5912115094195ad_0000001.ts
2019-11-20 17:28:43.044 9018-9317/com.piglet D/M3U8InfoThread: #EXTINF:1.001000,

在@Download.onTaskRunning回调中,速度不正常:
log:
2019-11-20 17:28:58.411 9018-9018/com.piglet I/chen debug: onTaskRunning:speed: 1
getConvertSpeed: 1.0b/s

从7.5换到7.7出现一样的问题。 除了速度不正常其他的数据都是正常的。最后合并的文件数据也是正常的。

测试url :任务https://fangao.qfxmj.com/video/20190918/f15d430211544e2da5aabeb11b4759d0/cloudv-transfer/55555555r4orsso65556q165s5918579_d39b8f459f2947eda73216b14d0651bc_0_3.m3u8?wsSecret=caacd942104dbc0d9d385076c6ea3be4&wsTime=1574242422

由于服务器的时间限制,url 地址应该会失效。 如果大神需要测试 @我。

@AriaLyy

This comment has been minimized.

Copy link
Owner

@AriaLyy AriaLyy commented Nov 20, 2019

使用3.7.8-pre-1版本

AriaLyy added a commit that referenced this issue Nov 20, 2019
@AriaLyy AriaLyy closed this Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.