We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
分析后发现问题出在这里。 类 Mp4Response.java 方法 public void sendBody(Socket socket, OutputStream outputStream, long pending) throws Exception{
} 如下代码 while (bufferLength > 0 && (readLength = randomAccessFile.read(buffer, 0, (int) bufferLength)) != -1) { offset += readLength; outputStream.write(buffer, 0, readLength); randomAccessFile.seek(offset); bufferLength = (avilable - offset + 1) > bufferedSize ? bufferedSize : (avilable - offset + 1); } 这里判断条件有问题。当第一次seek到结尾的时候,缓存文件中前面段没写入的数据,此段数据为空数据,再次往回seek,此时read 后,readLength 长度不是-1,但向buffer数组中写入的全是0,播放器接受到的全是空数据,也跳不出while循环。
The text was updated successfully, but these errors were encountered:
分析后发现问题出在这里。 类 Mp4Response.java 方法 public void sendBody(Socket socket, OutputStream outputStream, long pending) throws Exception{ } 如下代码 while (bufferLength > 0 && (readLength = randomAccessFile.read(buffer, 0, (int) bufferLength)) != -1) { offset += readLength; outputStream.write(buffer, 0, readLength); randomAccessFile.seek(offset); bufferLength = (avilable - offset + 1) > bufferedSize ? bufferedSize : (avilable - offset + 1); } 这里判断条件有问题。当第一次seek到结尾的时候,缓存文件中前面段没写入的数据,此段数据为空数据,再次往回seek,此时read 后,readLength 长度不是-1,但向buffer数组中写入的全是0,播放器接受到的全是空数据,也跳不出while循环。
大佬,这个问题最后怎么解决的呢?
Sorry, something went wrong.
No branches or pull requests
分析后发现问题出在这里。
类 Mp4Response.java
方法 public void sendBody(Socket socket, OutputStream outputStream, long pending) throws Exception{
}
如下代码
while (bufferLength > 0 && (readLength = randomAccessFile.read(buffer, 0, (int) bufferLength)) != -1) {
offset += readLength;
outputStream.write(buffer, 0, readLength);
randomAccessFile.seek(offset);
bufferLength = (avilable - offset + 1) > bufferedSize ? bufferedSize : (avilable - offset + 1);
}
这里判断条件有问题。当第一次seek到结尾的时候,缓存文件中前面段没写入的数据,此段数据为空数据,再次往回seek,此时read 后,readLength 长度不是-1,但向buffer数组中写入的全是0,播放器接受到的全是空数据,也跳不出while循环。
The text was updated successfully, but these errors were encountered: