Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
3e145efb
I
ijkplayer
项目概览
qq_25606643
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ijkplayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3e145efb
编写于
1月 03, 2014
作者:
B
bbcallen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ijkplayer: optimized buffering
上级
a6ff3b06
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
13 deletion
+37
-13
ijkmedia/ijkplayer/ff_ffplay.c
ijkmedia/ijkplayer/ff_ffplay.c
+22
-6
ijkmedia/ijkplayer/ff_ffplay_def.h
ijkmedia/ijkplayer/ff_ffplay_def.h
+15
-7
未找到文件。
ijkmedia/ijkplayer/ff_ffplay.c
浏览文件 @
3e145efb
...
@@ -1931,6 +1931,7 @@ static int read_thread(void *arg)
...
@@ -1931,6 +1931,7 @@ static int read_thread(void *arg)
int
last_error
=
0
;
int
last_error
=
0
;
int
last_buffered_time_percentage
=
-
1
;
int
last_buffered_time_percentage
=
-
1
;
int
last_buffered_size_percentage
=
-
1
;
int
last_buffered_size_percentage
=
-
1
;
int
hwm_in_ms
=
ffp
->
fast_high_water_mark_in_ms
;
// use fast water mark for first loading
memset
(
st_index
,
-
1
,
sizeof
(
st_index
));
memset
(
st_index
,
-
1
,
sizeof
(
st_index
));
is
->
last_video_stream
=
is
->
video_stream
=
-
1
;
is
->
last_video_stream
=
is
->
video_stream
=
-
1
;
...
@@ -2099,6 +2100,8 @@ static int read_thread(void *arg)
...
@@ -2099,6 +2100,8 @@ static int read_thread(void *arg)
// FIXME the +-2 is due to rounding being not done in the correct direction in generation
// FIXME the +-2 is due to rounding being not done in the correct direction in generation
// of the seek_pos/seek_rel variables
// of the seek_pos/seek_rel variables
hwm_in_ms
=
ffp
->
fast_high_water_mark_in_ms
;
ffp_toggle_buffering
(
ffp
,
1
);
ret
=
avformat_seek_file
(
is
->
ic
,
-
1
,
seek_min
,
seek_target
,
seek_max
,
is
->
seek_flags
);
ret
=
avformat_seek_file
(
is
->
ic
,
-
1
,
seek_min
,
seek_target
,
seek_max
,
is
->
seek_flags
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
av_log
(
NULL
,
AV_LOG_ERROR
,
...
@@ -2140,6 +2143,7 @@ static int read_thread(void *arg)
...
@@ -2140,6 +2143,7 @@ static int read_thread(void *arg)
step_to_next_frame_l
(
ffp
);
step_to_next_frame_l
(
ffp
);
SDL_UnlockMutex
(
ffp
->
is
->
play_mutex
);
SDL_UnlockMutex
(
ffp
->
is
->
play_mutex
);
ffp_notify_msg1
(
ffp
,
FFP_MSG_SEEK_COMPLETE
);
ffp_notify_msg1
(
ffp
,
FFP_MSG_SEEK_COMPLETE
);
ffp_toggle_buffering
(
ffp
,
1
);
}
}
if
(
is
->
queue_attachments_req
)
{
if
(
is
->
queue_attachments_req
)
{
if
(
is
->
video_st
&&
(
is
->
video_st
->
disposition
&
AV_DISPOSITION_ATTACHED_PIC
))
{
if
(
is
->
video_st
&&
(
is
->
video_st
->
disposition
&
AV_DISPOSITION_ATTACHED_PIC
))
{
...
@@ -2257,7 +2261,7 @@ static int read_thread(void *arg)
...
@@ -2257,7 +2261,7 @@ static int read_thread(void *arg)
int
buf_size_percent
=
-
1
;
int
buf_size_percent
=
-
1
;
int
buf_time_percent
=
-
1
;
int
buf_time_percent
=
-
1
;
int
hwm_in_bytes
=
ffp
->
high_water_mark_in_bytes
;
int
hwm_in_bytes
=
ffp
->
high_water_mark_in_bytes
;
int
hwm_in_ms
=
ffp
->
high_water_mark_in_ms
;
int
need_start_buffering
=
0
;
if
(
hwm_in_ms
>
0
)
{
if
(
hwm_in_ms
>
0
)
{
int
cached_duration_in_ms
=
-
1
;
int
cached_duration_in_ms
=
-
1
;
int64_t
audio_cached_duration
=
-
1
;
int64_t
audio_cached_duration
=
-
1
;
...
@@ -2304,9 +2308,21 @@ static int read_thread(void *arg)
...
@@ -2304,9 +2308,21 @@ static int read_thread(void *arg)
if
(
buf_time_percent
>=
0
)
{
if
(
buf_time_percent
>=
0
)
{
// alwas depend on cache duration if valid
// alwas depend on cache duration if valid
if
(
buf_time_percent
>=
100
)
if
(
buf_time_percent
>=
100
)
ffp_toggle_buffering
(
ffp
,
0
)
;
need_start_buffering
=
1
;
}
else
{
}
else
{
if
(
buf_size_percent
>=
100
)
if
(
buf_size_percent
>=
100
)
need_start_buffering
=
1
;
}
if
(
need_start_buffering
)
{
if
(
hwm_in_ms
<
ffp
->
normal_high_water_mark_in_ms
)
hwm_in_ms
=
ffp
->
normal_high_water_mark_in_ms
;
hwm_in_ms
*=
2
;
if
(
hwm_in_ms
>
ffp
->
max_high_water_mark_in_ms
)
hwm_in_ms
=
ffp
->
max_high_water_mark_in_ms
;
ffp_toggle_buffering
(
ffp
,
0
);
ffp_toggle_buffering
(
ffp
,
0
);
}
}
}
while
(
0
);
}
while
(
0
);
...
...
ijkmedia/ijkplayer/ff_ffplay_def.h
浏览文件 @
3e145efb
...
@@ -28,8 +28,12 @@
...
@@ -28,8 +28,12 @@
#include "ff_ffplay_config.h"
#include "ff_ffplay_config.h"
#include "ff_ffmsg_queue.h"
#include "ff_ffmsg_queue.h"
#define DEFAULT_HIGH_WATER_MARK_IN_MS (10 * 1000)
#define DEFAULT_HIGH_WATER_MARK_IN_BYTES (128 * 1024)
#define DEFAULT_HIGH_WATER_MARK_IN_BYTES (128 * 1024)
#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS (10 * 1000)
#define DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS (2 * 1000)
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS (100)
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 50000
#define MIN_FRAMES 50000
...
@@ -430,8 +434,10 @@ typedef struct FFPlayer {
...
@@ -430,8 +434,10 @@ typedef struct FFPlayer {
MessageQueue
msg_queue
;
MessageQueue
msg_queue
;
int
high_water_mark_in_ms
;
int
high_water_mark_in_bytes
;
int
high_water_mark_in_bytes
;
int
max_high_water_mark_in_ms
;
int
normal_high_water_mark_in_ms
;
int
fast_high_water_mark_in_ms
;
int
max_buffer_size
;
int
max_buffer_size
;
int
skip_loop_filter
;
int
skip_loop_filter
;
...
@@ -502,8 +508,10 @@ inline static void ffp_reset_internal(FFPlayer *ffp)
...
@@ -502,8 +508,10 @@ inline static void ffp_reset_internal(FFPlayer *ffp)
ffp
->
prepared
=
0
;
ffp
->
prepared
=
0
;
ffp
->
auto_start
=
0
;
ffp
->
auto_start
=
0
;
ffp
->
high_water_mark_in_ms
=
DEFAULT_HIGH_WATER_MARK_IN_MS
;
ffp
->
high_water_mark_in_bytes
=
DEFAULT_HIGH_WATER_MARK_IN_BYTES
;
ffp
->
high_water_mark_in_bytes
=
DEFAULT_HIGH_WATER_MARK_IN_BYTES
;
ffp
->
max_high_water_mark_in_ms
=
DEFAULT_MAX_HIGH_WATER_MARK_IN_MS
;
ffp
->
normal_high_water_mark_in_ms
=
DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS
;
ffp
->
fast_high_water_mark_in_ms
=
DEFAULT_FAST_HIGH_WATER_MARK_IN_MS
;
ffp
->
max_buffer_size
=
MAX_QUEUE_SIZE
;
ffp
->
max_buffer_size
=
MAX_QUEUE_SIZE
;
ffp
->
skip_loop_filter
=
AVDISCARD_ALL
;
ffp
->
skip_loop_filter
=
AVDISCARD_ALL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录