언어 설정

Menu
Sites
Language
OnPlayerEndOfClip premature or out of sync

Hi,

I'm getting an unusual error on the Tizen::Media:Player. OnPlayerEndOfClip callback seem to arrive after the audio player was stopped.

To be more clear here is how the system is setup. We use the MediaPlayer to playback audio files that read text. The user can chose to listed the audio to the end or just move to the next page/audio clip. 

So we have two main flow, suppose (A) and (B) are the two audio buffers:

1) OPEN (A) -> PLAY (A) -> ENDOFCLIP (A) -> CLOSE(A) -> OPEN (B) -> PLAY (B) etc....

2) OPEN (A) -> PLAY(A) -> STOP (A) -> CLOSE (A) -> OPEN (B) -> PLAY (B) etc..

This works fine 99% of the time but once in a while I get an error on the flow 2). It seems that ENDOFCLIP from A arrive after right after I started to PLAY (B)

This is how the error flow looks like

OPEN (A) -> PLAY (A) -> STOP (A) -> CLOSE (A) -> OPEN (B) -> PLAY (B) -> ENDOFCLIP( A? immediatly after I play B )

There are two options on why I get ENDOFCLIP so quickly

1) ENDOFCLIP call is the call back from A that was never cancelled

2) there was some kind of error in playing B buffer and it ends prematurely. 

I'm prone to believe 1) is the issue as an error in playback should call OnPlayerErrorOccurred but this function is never called. 

This is fairly rare (one every 30mins of testing). The timing is very fast we update audio at 30fps so there are probably 0.33ms between the stopping of A and starting of B and the ENDOFCLIP of A. If this is the case this would be a bug in the media player. Unfortunatelly as far as I know I don't have a way to test what clip the ENDOFCLIP callback is related to so I cannot be 100%.

If anyone has seens a similar issue or has any suggestions, I would be really appreciated.

Thanks,

Stefano

Responses

1 댓글
Stefano Zanetti

Ok I think I figure out what the problem is and a workaround I post it here as it could be useful to someone else. 

I can confirm that the issue is due to the fact that buffer A OnPlayerEndOfClip happen after the new Buffer B is already started. But the flow indicated above is not 100% correct here is how it happen

  1. OPEN (A)
  2. PLAY (A)
  3. try to STOP (A) but A is alredy in ENDOFCLIP status so it cannot be stopped the callback did not happen yet
  4. CLOSE (A)
  5. OPEN (B)
  6. PLAY (B)
  7. OnPlayerEndOfClip (A) finally arrive.

So seems like once the player enter ENDOFCLIP status it will call OnPlayerEndOfClip even if you close it. I guessing the callback is on a different thread and cannot be stopped at that point.

At the moment I use a workaround and whenever I receive a stop request if the player is already in ENDOFCLIP I don't do anything and wait for the callback on OnPlayerEndOfClip only after this I close the player and proceed in loading the next audio buffer (B).