Skip to content
New issue

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

Loop with external clock and onSync Callback #84

Open
pfaffinger opened this issue Jan 26, 2023 · 1 comment
Open

Loop with external clock and onSync Callback #84

pfaffinger opened this issue Jan 26, 2023 · 1 comment

Comments

@pfaffinger
Copy link

pfaffinger commented Jan 26, 2023

Hello,

I got an application with a kind of video wall output with a max of 4 simultaneous player instances, which are synchronize through the onSync callback and an external clock class. I can do all normal control stuff like play, pause, forward and backward seek, increase playback speed, etc.

The problem is the looping. We concat various video snippets prepended, appended and filled with black video snippets to first of all get the same length for all 4 streams and also fill in black video snippets, when a channel is not supplying a video material for a given timestamp. What happens now is, the looping onLoop callback is not called immediately when one channel got the video EOF. From the player logs we see that the the video eof is fired, but the audio stream eof is comming several seconds later and the player is waiting for it until its doing the loop.

I disabled the external syncronisation and the loop is done immediately. What is missing, does the external clock need to do something, but when and how to know when? Or is it the range setting thats wrong? We use setLoop(-1) and setRange(0, -1).

Following a part of the log output, started by the time the first video ends and until the onLoop callback for the first video is fired. Its about 7 seconds until the loop is processed.

DEBUG 2023-01-26T11:27:13.071 default 000002A72677DF40 FrameReader::update MediaStatus 0X124=>0X164
DEBUG 2023-01-26T11:27:13.071 read packet error. FrameReader@000002A72677DF40 sending Packet::End to all packet queues. PacketIO@000002A73D422610 ->url: C:/Users/.../0.mp4
DEBUG 2023-01-26T11:27:13.461 000002A72677DF40 #video stream#0 end semaphore acquire
DEBUG 2023-01-26T11:27:13.991 default 000002A7373E22C0 FrameReader::update MediaStatus 0X124=>0X164
DEBUG 2023-01-26T11:27:13.991 read packet error. FrameReader@000002A7373E22C0 sending Packet::End to all packet queues. PacketIO@000002A73D423390 ->url: C:/Users/.../1.mp4
DEBUG 2023-01-26T11:27:13.991 000002A7373E22C0 #video stream#0 end semaphore acquire
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @370.896
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @370.936
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @370.976
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @371.016
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @371.056
DEBUG 2023-01-26T11:27:14.742 video frame cached in decoder overlaps @371.096
DEBUG 2023-01-26T11:27:14.742 video stream#0 EOF/EOS decoded. end: 1
DEBUG 2023-01-26T11:27:14.751 default 000002A7373E6730 FrameReader::update MediaStatus 0X124=>0X164
DEBUG 2023-01-26T11:27:14.751 read packet error. FrameReader@000002A7373E6730 sending Packet::End to all packet queues. PacketIO@000002A73D422E80 ->url: C:/Users/.../2.mp4
DEBUG 2023-01-26T11:27:14.751 000002A7373E6730 #video stream#0 end semaphore acquire
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.304
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.344
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.384
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.424
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.464
DEBUG 2023-01-26T11:27:15.150 video frame cached in decoder overlaps @371.504
DEBUG 2023-01-26T11:27:15.150 video stream#0 EOF/EOS decoded. end: 1
DEBUG 2023-01-26T11:27:15.310 video stream#0 check loop range for EOS. dec_state.seeking: 0
DEBUG 2023-01-26T11:27:15.310 000002A727528010 track#0: @9223372036854775806. loop bits 1/3.
DEBUG 2023-01-26T11:27:15.310 000002A727528010 track#0: wait for other tracks to go out of loop range @9223372036854775806. 1/3.
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.649
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.689
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.729
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.769
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.809
DEBUG 2023-01-26T11:27:15.500 video frame cached in decoder overlaps @371.849
DEBUG 2023-01-26T11:27:15.501 video stream#0 EOF/EOS decoded. end: 1
DEBUG 2023-01-26T11:27:15.719 video stream#0 check loop range for EOS. dec_state.seeking: 0
DEBUG 2023-01-26T11:27:15.719 000002A7383C1E70 track#0: @9223372036854775806. loop bits 1/3.
DEBUG 2023-01-26T11:27:15.719 000002A7383C1E70 track#0: wait for other tracks to go out of loop range @9223372036854775806. 1/3.
DEBUG 2023-01-26T11:27:16.067 video stream#0 check loop range for EOS. dec_state.seeking: 0
DEBUG 2023-01-26T11:27:16.067 000002A73D5F0050 track#0: @9223372036854775806. loop bits 1/3.
DEBUG 2023-01-26T11:27:16.067 000002A73D5F0050 track#0: wait for other tracks to go out of loop range @9223372036854775806. 1/3.
DEBUG 2023-01-26T11:27:16.273 buffering progress 0%
DEBUG 2023-01-26T11:27:16.273 default 000002A7373E42B0 FrameReader::update MediaStatus 0X124=>0X114
DEBUG 2023-01-26T11:27:16.273 ++++++++++++BUFFERING START++++++++++++
DEBUG 2023-01-26T11:27:16.273
DEBUG 2023-01-26T11:27:16.305 default 000002A7373E42B0 FrameReader::update MediaStatus 0X114=>0X154
DEBUG 2023-01-26T11:27:16.305 read packet error. FrameReader@000002A7373E42B0 sending Packet::End to all packet queues. PacketIO@000002A73D423C00 ->url: C:/Users/.../3.mp4
DEBUG 2023-01-26T11:27:16.305 000002A7373E42B0 #video stream#0 end semaphore acquire
DEBUG 2023-01-26T11:27:16.315 buffering progress 100%
DEBUG 2023-01-26T11:27:16.315 default 000002A7373E42B0 FrameReader::update MediaStatus 0X154=>0X164
DEBUG 2023-01-26T11:27:16.315 ++++++++++++BUFFERING END++++++++++++
DEBUG 2023-01-26T11:27:16.315
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @372.88
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @372.92
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @372.96
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @373
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @373.04
DEBUG 2023-01-26T11:27:16.708 video frame cached in decoder overlaps @373.08
DEBUG 2023-01-26T11:27:16.708 video stream#0 EOF/EOS decoded. end: 1
DEBUG 2023-01-26T11:27:17.282 video stream#0 check loop range for EOS. dec_state.seeking: 0
DEBUG 2023-01-26T11:27:17.282 000002A73D42B0E0 track#0: @9223372036854775806. loop bits 1/3.
DEBUG 2023-01-26T11:27:17.282 000002A73D42B0E0 track#0: wait for other tracks to go out of loop range @9223372036854775806. 1/3.
DEBUG 2023-01-26T11:27:21.521 audio stream#1 EOF/EOS decoded. end: 1
DEBUG 2023-01-26T11:27:21.521 audio stream#1 check loop range for EOS. dec_state.seeking: 0
DEBUG 2023-01-26T11:27:21.521 000002A727528010 track#1: @9223372036854775806. loop bits 3/3.
DEBUG 2023-01-26T11:27:21.521 000002A727528010 track#1: all tracks are out of loop range. seek to loop A from 9223372036854775806
DEBUG 2023-01-26T11:27:21.521 void __cdecl ChannelData::onLoop(int)
DEBUG 2023-01-26T11:27:21.521 Channel: 0
DEBUG 2023-01-26T11:27:21.521 LoopCount: 0

I am using Version 0.19.

@wang-bin
Copy link
Owner

wang-bin commented Feb 8, 2023

What happens now is, the looping onLoop callback is not called immediately when one channel got the video EOF. From the player logs we see that the the video eof is fired, but the audio stream eof is comming several seconds later and the player is waiting for it until its doing the loop.

I disabled the external syncronisation and the loop is done immediately. What is missing, does the external clock need to do something, but when and how to know when? Or is it the range setting thats wrong? We use setLoop(-1) and setRange(0, -1).

Following a part of the log output, started by the time the first video ends and until the onLoop callback for the first video is fired. Its about 7 seconds until the loop is processed.

The first line of log is eof of demuxing, not decoding. eof frame will be decoded several seconds later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants