mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Handle jump in stream like stream start.
This commit is contained in:
parent
d26c34f34f
commit
e30e1e5aad
@ -1,6 +1,7 @@
|
|||||||
User johns
|
User johns
|
||||||
Date:
|
Date:
|
||||||
|
|
||||||
|
Handle jump in stream like stream start.
|
||||||
Always compile audio drift correction.
|
Always compile audio drift correction.
|
||||||
Add audio drift correction configuration to the setup.
|
Add audio drift correction configuration to the setup.
|
||||||
|
|
||||||
|
@ -1374,6 +1374,7 @@ int VideoDecode(void)
|
|||||||
VideoPacketRead = VideoPacketWrite;
|
VideoPacketRead = VideoPacketWrite;
|
||||||
if (MyVideoDecoder) {
|
if (MyVideoDecoder) {
|
||||||
CodecVideoFlushBuffers(MyVideoDecoder);
|
CodecVideoFlushBuffers(MyVideoDecoder);
|
||||||
|
VideoResetStart(MyHwDecoder);
|
||||||
}
|
}
|
||||||
VideoClearBuffers = 0;
|
VideoClearBuffers = 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
37
video.c
37
video.c
@ -1342,6 +1342,7 @@ struct _vaapi_decoder_
|
|||||||
int64_t PTS; ///< video PTS clock
|
int64_t PTS; ///< video PTS clock
|
||||||
|
|
||||||
int SyncCounter; ///< counter to sync frames
|
int SyncCounter; ///< counter to sync frames
|
||||||
|
int StartCounter; ///< counter for video start
|
||||||
int FramesDuped; ///< number of frames duplicated
|
int FramesDuped; ///< number of frames duplicated
|
||||||
int FramesMissed; ///< number of frames missed
|
int FramesMissed; ///< number of frames missed
|
||||||
int FramesDropped; ///< number of frames dropped
|
int FramesDropped; ///< number of frames dropped
|
||||||
@ -1862,6 +1863,7 @@ static void VaapiCleanup(VaapiDecoder * decoder)
|
|||||||
decoder->SyncCounter = 0;
|
decoder->SyncCounter = 0;
|
||||||
decoder->FrameCounter = 0;
|
decoder->FrameCounter = 0;
|
||||||
decoder->FramesDisplayed = 0;
|
decoder->FramesDisplayed = 0;
|
||||||
|
decoder->StartCounter = 0;
|
||||||
decoder->Closing = 0;
|
decoder->Closing = 0;
|
||||||
decoder->PTS = AV_NOPTS_VALUE;
|
decoder->PTS = AV_NOPTS_VALUE;
|
||||||
VideoDeltaPTS = 0;
|
VideoDeltaPTS = 0;
|
||||||
@ -4303,6 +4305,7 @@ static void VaapiDisplayFrame(void)
|
|||||||
|
|
||||||
decoder = VaapiDecoders[i];
|
decoder = VaapiDecoders[i];
|
||||||
decoder->FramesDisplayed++;
|
decoder->FramesDisplayed++;
|
||||||
|
decoder->StartCounter++;
|
||||||
|
|
||||||
filled = atomic_read(&decoder->SurfacesFilled);
|
filled = atomic_read(&decoder->SurfacesFilled);
|
||||||
// no surface availble show black with possible osd
|
// no surface availble show black with possible osd
|
||||||
@ -4461,12 +4464,12 @@ static void VaapiSyncDecoder(VaapiDecoder * decoder)
|
|||||||
decoder->TrickCounter = decoder->TrickSpeed;
|
decoder->TrickCounter = decoder->TrickSpeed;
|
||||||
}
|
}
|
||||||
// at start of new video stream, soft or hard sync video to audio
|
// at start of new video stream, soft or hard sync video to audio
|
||||||
if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames
|
if (!VideoSoftStartSync && decoder->StartCounter < VideoSoftStartFrames
|
||||||
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|
||||||
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
|
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
|
||||||
err =
|
err =
|
||||||
VaapiMessage(3, "video: initial slow down video, frame %d\n",
|
VaapiMessage(3, "video: initial slow down video, frame %d\n",
|
||||||
decoder->FramesDisplayed);
|
decoder->StartCounter);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5025,6 +5028,7 @@ typedef struct _vdpau_decoder_
|
|||||||
int64_t PTS; ///< video PTS clock
|
int64_t PTS; ///< video PTS clock
|
||||||
|
|
||||||
int SyncCounter; ///< counter to sync frames
|
int SyncCounter; ///< counter to sync frames
|
||||||
|
int StartCounter; ///< counter for video start
|
||||||
int FramesDuped; ///< number of frames duplicated
|
int FramesDuped; ///< number of frames duplicated
|
||||||
int FramesMissed; ///< number of frames missed
|
int FramesMissed; ///< number of frames missed
|
||||||
int FramesDropped; ///< number of frames dropped
|
int FramesDropped; ///< number of frames dropped
|
||||||
@ -5742,6 +5746,7 @@ static void VdpauCleanup(VdpauDecoder * decoder)
|
|||||||
decoder->SyncCounter = 0;
|
decoder->SyncCounter = 0;
|
||||||
decoder->FrameCounter = 0;
|
decoder->FrameCounter = 0;
|
||||||
decoder->FramesDisplayed = 0;
|
decoder->FramesDisplayed = 0;
|
||||||
|
decoder->StartCounter = 0;
|
||||||
decoder->Closing = 0;
|
decoder->Closing = 0;
|
||||||
decoder->PTS = AV_NOPTS_VALUE;
|
decoder->PTS = AV_NOPTS_VALUE;
|
||||||
VideoDeltaPTS = 0;
|
VideoDeltaPTS = 0;
|
||||||
@ -7542,6 +7547,7 @@ static void VdpauDisplayFrame(void)
|
|||||||
|
|
||||||
decoder = VdpauDecoders[i];
|
decoder = VdpauDecoders[i];
|
||||||
decoder->FramesDisplayed++;
|
decoder->FramesDisplayed++;
|
||||||
|
decoder->StartCounter++;
|
||||||
|
|
||||||
filled = atomic_read(&decoder->SurfacesFilled);
|
filled = atomic_read(&decoder->SurfacesFilled);
|
||||||
// need 1 frame for progressive, 3 frames for interlaced
|
// need 1 frame for progressive, 3 frames for interlaced
|
||||||
@ -7685,12 +7691,12 @@ static void VdpauSyncDecoder(VdpauDecoder * decoder)
|
|||||||
decoder->TrickCounter = decoder->TrickSpeed;
|
decoder->TrickCounter = decoder->TrickSpeed;
|
||||||
}
|
}
|
||||||
// at start of new video stream, soft or hard sync video to audio
|
// at start of new video stream, soft or hard sync video to audio
|
||||||
if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames
|
if (!VideoSoftStartSync && decoder->StartCounter < VideoSoftStartFrames
|
||||||
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|
||||||
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
|
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
|
||||||
err =
|
err =
|
||||||
VdpauMessage(3, "video: initial slow down video, frame %d\n",
|
VdpauMessage(3, "video: initial slow down video, frame %d\n",
|
||||||
decoder->FramesDisplayed);
|
decoder->StartCounter);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9187,6 +9193,29 @@ void VideoSetClosing(VideoHwDecoder * hw_decoder)
|
|||||||
VideoSetClock(hw_decoder, AV_NOPTS_VALUE);
|
VideoSetClock(hw_decoder, AV_NOPTS_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Reset start of frame counter.
|
||||||
|
///
|
||||||
|
/// @param hw_decoder video hardware decoder
|
||||||
|
///
|
||||||
|
void VideoResetStart(VideoHwDecoder * hw_decoder)
|
||||||
|
{
|
||||||
|
Debug(3, "video: reset start\n");
|
||||||
|
// FIXME: test to check if working, than make module function
|
||||||
|
#ifdef USE_VDPAU
|
||||||
|
if (VideoUsedModule == &VdpauModule) {
|
||||||
|
hw_decoder->Vdpau.StartCounter = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef USE_VAPI
|
||||||
|
if (VideoUsedModule == &VaapiModule) {
|
||||||
|
hw_decoder->Vaapi.StartCounter = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// clear clock to trigger new video stream
|
||||||
|
VideoSetClock(hw_decoder, AV_NOPTS_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set trick play speed.
|
/// Set trick play speed.
|
||||||
///
|
///
|
||||||
|
3
video.h
3
video.h
@ -159,6 +159,9 @@ extern int64_t VideoGetClock(const VideoHwDecoder *);
|
|||||||
/// Set closing flag.
|
/// Set closing flag.
|
||||||
extern void VideoSetClosing(VideoHwDecoder *);
|
extern void VideoSetClosing(VideoHwDecoder *);
|
||||||
|
|
||||||
|
/// Reset start of frame counter
|
||||||
|
extern void VideoResetStart(VideoHwDecoder *);
|
||||||
|
|
||||||
/// Set trick play speed.
|
/// Set trick play speed.
|
||||||
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
|
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user