Switch interpipe pipeline from live source to replay
Hello I am currently working on a little application and I am struggling to find the timestamp issue and resolve it.
There is 3 pipelines (simplified):
- v4l2src ! interpipesink name=camera
- interpipesrc listen-to=camera ! queue ! imxg2dvideosink (I work on imx6, but it can be reproduced with other display)
- filesrc ! qtdemux ! h264parse ! decodebin ! interpipesink name=replay
So there is two sources. The live source is the default one, and the replay can be activated on demand. Once requested the interpipesrc listen to the replay instead of the camera source.
This is what I noted, let's say we start the application (with the 3 pipelines) at T+0, and the mp4 file is 20 seconds long:
- If I start the replay at T+0, the replay stops at T+20 and the listener is modified to camera, it works
- If I start the replay at T+10, the replay "works" (I have a part of the replay) and stop at T+20 (instead of T+30)
- If I start the replay after T+20, the replay did not work, I got an EOS on the replay pipeline after 1-2 seconds
What I have tested so far:
- Modify interpipesrc stream-sync property, with 1 the replay speed is normal, with 0, the speed is increased.
- Modify interpipesrc format to 3, no effect
- Get display last sample timestamp and set the interpipesrc ts-offset at this value
- Modify the PTS/DTS of the replay buffers
- I have check the clock sources of all pipelines and they are the same.
With the last 2 point, I was able to have a smooth replay, but only between T+0 and T+20.
Did I miss something? I think there is some configuration on the interpipes in this case but I am completely lost.
Are you playing the filesrc's pipeline in starting?? If yes then please try to start that pipeline just before switching. May be this will resolve your problem.
You switching from src camera to filesrc right ?