Skip to content

Commit 937be20

Browse files
committed
Remove ecore_main_loop_thread_safe_call_async
1 parent 2e24137 commit 937be20

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

packages/audioplayers/tizen/src/audio_player.cc

+7-13
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void AudioPlayer::Play() {
5858
throw AudioPlayerError("player_start failed", get_error_message(ret));
5959
}
6060
should_play_ = false;
61-
EmitPositionUpdates();
61+
StartPositionUpdates();
6262
break;
6363
}
6464
default:
@@ -284,10 +284,6 @@ void AudioPlayer::PreparePlayer() {
284284
seeking_ = false;
285285
}
286286

287-
void AudioPlayer::EmitPositionUpdates() {
288-
ecore_main_loop_thread_safe_call_async(StartPositionUpdates, this);
289-
}
290-
291287
void AudioPlayer::ResetPlayer() {
292288
player_state_e state = GetPlayerState();
293289
switch (state) {
@@ -340,7 +336,7 @@ void AudioPlayer::OnPrepared(void *data) {
340336
if (ret != PLAYER_ERROR_NONE) {
341337
throw AudioPlayerError("player_start failed", get_error_message(ret));
342338
}
343-
player->EmitPositionUpdates();
339+
player->StartPositionUpdates();
344340
player->should_play_ = false;
345341
}
346342

@@ -381,16 +377,14 @@ void AudioPlayer::OnError(int code, void *data) {
381377
player->error_listener_(player->player_id_, "Player error: " + error);
382378
}
383379

384-
void AudioPlayer::StartPositionUpdates(void *data) {
385-
auto *player = reinterpret_cast<AudioPlayer *>(data);
386-
if (!player->timer_) {
380+
void AudioPlayer::StartPositionUpdates() {
381+
if (!timer_) {
387382
// The audioplayers app facing package expects position
388383
// update events to fire roughly every 200 milliseconds.
389384
const double kTimeInterval = 0.2;
390-
player->timer_ = ecore_timer_add(kTimeInterval, OnPositionUpdate, data);
391-
if (!player->timer_) {
392-
player->error_listener_(player->GetPlayerId(),
393-
"Failed to add postion update timer.");
385+
timer_ = ecore_timer_add(kTimeInterval, OnPositionUpdate, this);
386+
if (!timer_) {
387+
error_listener_(player_id_, "Failed to add postion update timer.");
394388
}
395389
}
396390
}

packages/audioplayers/tizen/src/audio_player.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,14 @@ class AudioPlayer {
5353
// The player state should be idle before calling this function.
5454
void PreparePlayer();
5555
void ResetPlayer();
56-
void EmitPositionUpdates();
56+
void StartPositionUpdates();
5757
player_state_e GetPlayerState();
5858

5959
static void OnPrepared(void *data);
6060
static void OnSeekCompleted(void *data);
6161
static void OnPlayCompleted(void *data);
6262
static void OnInterrupted(player_interrupted_code_e code, void *data);
6363
static void OnError(int code, void *data);
64-
static void StartPositionUpdates(void *data);
6564
static Eina_Bool OnPositionUpdate(void *data);
6665

6766
player_h player_ = nullptr;

0 commit comments

Comments
 (0)