Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0b7d0ada
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0b7d0ada
编写于
12月 16, 2021
作者:
R
ruanmeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
seek 校验方式修正 Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>
Signed-off-by:
N
ruanmeng
<
ruanmeng@huawei.com
>
上级
3835f7c9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
27 deletion
+35
-27
multimedia/media/media_cpp_test_standard/player/include/TestPlayer.h
...media/media_cpp_test_standard/player/include/TestPlayer.h
+2
-0
multimedia/media/media_cpp_test_standard/player/src/TestParamsConfig.cpp
...a/media_cpp_test_standard/player/src/TestParamsConfig.cpp
+0
-21
multimedia/media/media_cpp_test_standard/player/src/TestPlayer.cpp
...a/media/media_cpp_test_standard/player/src/TestPlayer.cpp
+33
-6
未找到文件。
multimedia/media/media_cpp_test_standard/player/include/TestPlayer.h
浏览文件 @
0b7d0ada
...
...
@@ -48,6 +48,7 @@ public:
PlayerStates
state_
=
PLAYER_IDLE
;
int32_t
seekPosition_
;
bool
seekDoneFlag_
;
PlayerSeekMode
seekMode_
=
PlayerSeekMode
::
SEEK_CLOSEST
;
bool
mutexFlag_
=
true
;
std
::
mutex
mutexSeek_
;
std
::
mutex
mutexReset_
;
...
...
@@ -107,6 +108,7 @@ public:
void
OnError
(
PlayerErrorType
errorType
,
int32_t
errorCode
);
int
WaitForSeekDone
(
int32_t
currentPosition
);
void
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
infoBody
=
{});
void
SeekNotify
(
int32_t
extra
,
const
Format
&
infoBody
);
int
WaitForState
(
PlayerStates
state
);
private:
void
PrintState
(
PlayerStates
state
);
...
...
multimedia/media/media_cpp_test_standard/player/src/TestParamsConfig.cpp
浏览文件 @
0b7d0ada
...
...
@@ -51,27 +51,6 @@ void TestParamsConfig::InitMountPath()
bool
TestParamsConfig
::
CompareTime
(
int32_t
expectTime
,
int32_t
realTime
,
OHOS
::
Media
::
PlayerSeekMode
seekMode
)
{
MEDIA_INFO_LOG
(
"CompareTime: expectTime %d, realTime %d"
,
expectTime
,
realTime
);
if
(
seekMode
==
PlayerSeekMode
::
SEEK_CLOSEST
)
{
if
(
std
::
abs
(
expectTime
-
realTime
)
<
CLOSEST_DELTA_TIME
)
{
return
true
;
}
else
{
return
false
;
}
}
if
(
seekMode
==
PlayerSeekMode
::
SEEK_NEXT_SYNC
)
{
if
(
realTime
-
expectTime
<
DELTA_TIME
&&
realTime
-
expectTime
>=
0
)
{
return
true
;
}
else
{
return
false
;
}
}
if
(
seekMode
==
PlayerSeekMode
::
SEEK_PREVIOUS_SYNC
)
{
if
(
expectTime
-
realTime
<
DELTA_TIME
&&
expectTime
-
realTime
>
-
CLOSEST_DELTA_TIME
)
{
return
true
;
}
else
{
return
false
;
}
}
if
(
std
::
abs
(
expectTime
-
realTime
)
<
DELTA_TIME
)
{
return
true
;
}
...
...
multimedia/media/media_cpp_test_standard/player/src/TestPlayer.cpp
浏览文件 @
0b7d0ada
...
...
@@ -146,7 +146,16 @@ int32_t TestPlayer::Seek(int32_t mseconds, PlayerSeekMode mode)
{
MEDIA_DEBUG_LOG
(
"%s"
,
__FUNCTION__
);
test_
->
seekDoneFlag_
=
false
;
test_
->
seekPosition_
=
mseconds
;
int32_t
duration
=
0
;
player_
->
GetDuration
(
duration
);
if
(
mseconds
<
0
)
{
test_
->
seekPosition_
=
0
;
}
else
if
(
mseconds
>
duration
){
test_
->
seekPosition_
=
duration
;
}
else
{
test_
->
seekPosition_
=
mseconds
;
}
test_
->
seekMode_
=
mode
;
int32_t
ret
=
player_
->
Seek
(
mseconds
,
mode
);
if
(
ret
==
RET_OK
&&
test_
->
mutexFlag_
==
true
&&
test_
->
seekDoneFlag_
==
false
)
{
std
::
unique_lock
<
std
::
mutex
>
lockSeek
(
test_
->
mutexSeek_
);
...
...
@@ -268,6 +277,28 @@ void TestPlayerCallback::OnError(PlayerErrorType errorType, int32_t errorCode)
errorTypeMsg
.
c_str
(),
errorCodeMsg
.
c_str
());
}
void
TestPlayerCallback
::
SeekNotify
(
int32_t
extra
,
const
Format
&
infoBody
)
{
if
(
test_
->
seekMode_
==
PlayerSeekMode
::
SEEK_CLOSEST
)
{
if
(
test_
->
seekPosition_
==
extra
)
{
test_
->
condVarSeek_
.
notify_all
();
}
}
else
if
(
test_
->
seekMode_
==
PlayerSeekMode
::
SEEK_PREVIOUS_SYNC
)
{
if
(
test_
->
seekPosition_
-
extra
<
DELTA_TIME
&&
extra
-
test_
->
seekPosition_
>=
0
)
{
test_
->
condVarSeek_
.
notify_all
();
}
}
else
if
(
test_
->
seekMode_
==
PlayerSeekMode
::
SEEK_NEXT_SYNC
)
{
if
(
extra
-
test_
->
seekPosition_
<
DELTA_TIME
&&
test_
->
seekPosition_
-
extra
>=
0
)
{
test_
->
condVarSeek_
.
notify_all
();
}
}
else
if
(
abs
(
test_
->
seekPosition_
-
extra
)
<=
DELTA_TIME
)
{
test_
->
condVarSeek_
.
notify_all
();
}
else
{
test_
->
SetSeekResult
(
false
);
}
return
;
}
void
TestPlayerCallback
::
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
infoBody
)
{
switch
(
type
)
{
...
...
@@ -275,11 +306,7 @@ void TestPlayerCallback::OnInfo(PlayerOnInfoType type, int32_t extra, const Form
seekDoneFlag_
=
true
;
test_
->
SetSeekResult
(
true
);
MEDIA_INFO_LOG
(
"TestPlayerCallback: OnSeekDone currentPosition is %d"
,
extra
);
if
(
abs
(
test_
->
seekPosition_
-
extra
)
<=
DELTA_TIME
)
{
test_
->
condVarSeek_
.
notify_all
();
}
else
{
test_
->
SetSeekResult
(
false
);
}
SeekNotify
(
extra
,
infoBody
);
break
;
case
INFO_TYPE_EOS
:
MEDIA_INFO_LOG
(
"TestPlayerCallback: OnEndOfStream isLooping is %d"
,
extra
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录