Mailing List Archive

[MythTV/mythtv] cb0e08: Scan streams again after PMT change
Branch: refs/heads/fixes/33
Home: https://github.com/MythTV/mythtv
Commit: cb0e08dd9ce97e0cca08f71e2346d3d4d27d991f
https://github.com/MythTV/mythtv/commit/cb0e08dd9ce97e0cca08f71e2346d3d4d27d991f
Author: Klaas de Waal <klaas@kldo.nl>
Date: 2023-08-15 (Tue, 15 Aug 2023)

Changed paths:
M mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c

Log Message:
-----------
Scan streams again after PMT change

When there is a change detected in the number of streams or in the type of streams after a new
PMT has been received then scan the streams again.
It is possible that the streams change during a recording. For instance, a commercial can have one
audio stream and then in the following program there can be an audio stream added.
This is what the Finnish broadcaster YLE is doing. It is completely standards-conforming but
it is as far as I am aware the only broadcaster that does this.
The original FFmpeg demuxer looks only at the streams as present in the beginning of the recording
and therefore it does not detect changes later in the recording.
Detecting stream changes while a recording is playing is a MythTV extension and it requires changes
to FFmpeg. This is one reason why there is a copy of FFmpeg included as part of MythTV, instead of
using the standard FFmpeg libraries that are part of the Linux system.
Initially the streams_changed callback was needed for correct video playback of YLE streams; see
commit ebeea33 from 2021. This did fix the problem of the screen sometimes showing only a 640x480 part
of the 1920x1080 area.
There has been a significant rewrite of the MythTV changes in file mpegts-mythtv.c in 2022 and one
result is that the video playback of YLE streams is now correct without rescanning the streams.
However, there is still the problem of audio stream changes not being picked up.
In commit ad9fb22 from 2022 it is mentioned that:
"The streams_changed callback has been disabled as it is now unnecessary
in my samples from the Finnish YLE that used to trigger it. It could
be re-enabled if necessary."
As it appears to be still necessary this commit does exactly that.
Note that when the streams_changed callback is called there is a pause of about one second,
caused by the SeekReset that is done before the ScanStreams. It is possible that the SeekReset
can be omitted.

(cherry picked from commit 4c49293a5b8a531603a348fccbf90816c9d939cb)


Commit: 21d2d9d951a0ce63303e7632a203e5268c9531a4
https://github.com/MythTV/mythtv/commit/21d2d9d951a0ce63303e7632a203e5268c9531a4
Author: Klaas de Waal <klaas@kldo.nl>
Date: 2023-08-15 (Tue, 15 Aug 2023)

Changed paths:
M mythtv/libs/libmythtv/decoders/avformatdecoder.cpp

Log Message:
-----------
Skip SeekReset before scanning streams again

In StreamChangeCheck, skip SeekReset before ScanStreams is called.
The SeekReset discards processed video frames and input buffers and this causes a part
of the video not being played plus a video freeze of about half a second.
It looks like this code is only called when there is a change in the streams after a new PMT
has been received and this happens only incidentally with streams from Finnish broadacaster YLE.
Skipping the SeekReset gives smooth playback on the YLE streams when there is a stream change.
A call to StreamChangeCheck can also be initiated from FFmpeg from libavformat/mpeg.c but I have not
been able to find a recording or a video other than the YLE recordings that does trigger this.
There is now a log message if the skip does happens just in case this might cause a regression.
For more details see commit 4c49293a5b8a531603a348fccbf90816c9d939cb.

(cherry picked from commit 826aa7525755e7af81444792e1c21e1748bab535)


Compare: https://github.com/MythTV/mythtv/compare/9572dc5a124b...21d2d9d951a0
_______________________________________________
mythtv-commits mailing list
mythtv-commits@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-commits