This commit adds the is_new flag to the EPG event data sent to HTSP clients.
By including this property, clients such as Kodi (with the pvr.hts addon)
can now detect whether a broadcast is marked as new and set corresponding
flags (e.g. EPG_TAG_FLAG_IS_NEW in Kodi).
This enhances the metadata available to clients and supports improved EPG
event handling and display.
A corresponding pull request will also be submitted to the pvr.hts project
to make use of this flag when obtaining EPG event guide data from Tvheadend.
transcode: gracefully handle common hardware decoder errors
When using VAAPI hardware decoding, certain malformed or corrupt frames at the
start of the stream may cause the ffmpeg h/w decoder to emit `AVERROR(EIO)` or
`AVERROR(EINVAL)` early in the picture decoding phase.
In these cases, libav will log errors such as:
[ ERROR]:libav: AVCodecContext: Failed to upload decode parameters: 18 (invalid parameter).
[ ERROR]:libav: AVCodecContext: Failed to end picture decode after error: 18 (invalid parameter).
[ ERROR]:libav: AVCodecContext: hardware accelerator failed to decode picture
Currently, Tvheadend treats these errors as fatal, resulting in the transcoder
stream being torn down via `tvh_stream_stop()` and interrupting client playback,
typically leaving only audio and a black screen.
While this behavior is somewhat tolerable during live TV viewing—where the user
can manually resolve the issue by changing channels—it is significantly more
disruptive in recording scenarios, as it results in recordings containing only
audio and no video.
However, when the same streams are run directly through FFmpeg’s CLI, FFmpeg
**does not abort** on these errors — it logs them and continues transcoding.
This makes FFmpeg's failure handling more robust than Tvheadend's.
To identify which errors should be considered recoverable, the transcoder was
instrumented to log the exact `AVERROR` codes encountered during decoding failures.
A stress test was then run using a channel-hopping script that switched channels
every 5 seconds over several hours. The failure rate was approximately 1%, and
in **all** cases, the decoding failures were either `AVERROR(EIO)` or
`AVERROR(EINVAL)`. Allowing the stream to continue after these specific errors
proved effective — playback resumed, and only a minor picture glitch was visible
at the affected frame, with no need to tear down the video stream.
This patch updates `tvh_context_decode()` to include `AVERROR(EIO)` and
`AVERROR(EINVAL)` in the list of tolerated decode errors, aligning Tvheadend's
behavior with FFmpeg’s more forgiving approach.
FFmpeg’s internal decoder logic in `vaapi_h264.c` and `decode.c` supports this
tolerance model. For example, in `decode_simple_internal()` and `submit_frame()`,
errors like `EIO` may occur during `av_hwframe_transfer_data()` or `vaEndPicture()`,
but are **not considered fatal**. Instead, FFmpeg logs the issue and decoding
continues on the next frame.
James Hutchinson [Fri, 16 May 2025 15:09:11 +0000 (16:09 +0100)]
transcode: improve logging of packet transcode errors
Improve visibility of decoding failures during transcoding by logging
the error code, a human-readable description, and the packet PTS when
the hardware decoder fails to process a packet.
Previously, these errors would silently trigger `tvh_stream_stop()` on
the affected stream, with minimal context about the underlying cause.
This made it difficult to diagnose issues such as hardware acceleration
glitches or codec-specific decode failures.
With this change, such errors are logged at warning level, and full
packet details are included if trace logging is enabled. This provides
valuable diagnostic information when investigating stream interruptions
or video dropout.
This commit does not alter transcoder behavior; errors are still
filtered or handled by other components as before. It simply makes
decoder error conditions more transparent for debugging purposes.
Ukn Unknown [Tue, 11 Feb 2025 00:39:02 +0000 (16:39 -0800)]
allow NVENC, VAAPI and MMAL to coexist in the same build
- allow NVENC, VAAPI and MMAL to coexist in the same build.
- give the user the capability for prioritize hw decoder or to match the hw decoder with hw encoder
- refactor source code: remove duplicate source code in codec.js
wizard: increase buffer size to silence -Wformat-truncation on GCC 15
GCC 15.1 introduces stricter checks around `snprintf`-like functions
under `-Wformat-truncation`, even when the format string itself is
under developer control. This triggers a false positive in
`hello_changed()` when building with `-Werror=format-truncation`:
error: ‘__builtin___snprintf_chk’ output may be truncated before the
last format character [-Werror=format-truncation=]
note: output between 1 and 33 bytes into a destination of size 32
This warning is triggered due to a theoretical edge case in
`tvh_strlcatf()` where combining strings like `"en,fr,de"` could
approach the buffer limit of 32 bytes. While truncation is unlikely in
practice, the warning is still emitted aggressively by the new FORTIFY
logic.
Increase the buffer from 32 to 64 bytes to silence the warning and
ensure headroom. This avoids having to disable the diagnostic, while
still keeping the logic and usage intact. This is a defensive fix with
no behavioral change, and aligns with similar mitigations used in other
projects facing the same issue with GCC >= 13 and especially 15+.
dave-p [Tue, 13 May 2025 06:38:55 +0000 (07:38 +0100)]
Remove links to old Wiki (#1793)
* Remove links to old Wiki. Fixes #1660
Also remove references to CIC and CLA, and other content where a more recent version exists on the documentation site.
Michael Marley [Tue, 13 May 2025 05:43:04 +0000 (01:43 -0400)]
httpc.c: Fix HTTPS with OpenSSL 3.5 (#1813)
The TLS Client Hello message is larger in OpenSSL 3.5 and will not
fit in the previous hc_io_size of 1024 bytes. This causes the TLS
Client Hello message to be truncated, resulting in HTTPS requests
stalling and eventually timing out. To fix this, increase
hc_io_size to 2048 bytes.
Michael Marley [Tue, 13 May 2025 05:41:47 +0000 (01:41 -0400)]
lovcombo-all.js: Fix autorec create/edit TypeError with Firefox 134 (#1786)
Firefox 134 added the RegExp.escape() method
(https://tc39.es/proposal-regex-escaping/#sec-regexp.escape) with a
standards-compliant implementation that throws TypeError if
any value other than a String is passed in. This differs from the
existing polyfill that simply returns the argument unmodified if it
isn't a String. In TVHeadend, the day-of-the-week selector (as
used in the Autorec and Timer configuration) uses Integers as keys
for options, causing an Integer to get passed to RegExp.escape() on
line 300 of lovcombo-all.js. Because of the non-standards-
compliant permissive behavior of the polyfill, this previously
didn't cause an issue. However, with Firefox 134 (and an upcoming
version of Safari), the added standards-compliant method causes a
TypeError to be thrown on every attempt to create or edit a timer
or autorec, causing the edit window to not be shown. To solve the
issue, pass the response from r.get(this.valueField) through the
String() constructor to ensure anything that gets passed in is a
String. This has been tested with Firefox and Chrome with both
Integer and String keys.
Fixup updating comment in _dvr_entry_update. Only overwrite existing title if comment is not NULL. Follows the same logic now as other updates done in this function.
Older versions of GCC don't like declaring a variable in the middle
of a switch/case and will fail with "error: a label can only be
part of a statement and a declaration is not a statement".
uknunknown [Fri, 16 Aug 2024 17:27:58 +0000 (10:27 -0700)]
fix bug in AAC channel layout configuration tab
fix bug in AAC channel layout configuration tab
There are few issues:
1. first entry in combo should be AUTO (with value 0) - in original code was set to 1 (and overwritten later)
2. l->nb_channel is not the best way to cycle though layouts available. At the end I think is accessing some region outside of the struct (because I see is lopped also after 7.1). The way I knew how to fix was to add the filter (l->nb_channels < 32). Maybe changing the while to for will be a better option.
3. av_channel_layout() is returning the length of the string ... we should use l_buf only when retuned value > 0 ... when is < 0 l_buf was not updated.
uknunknown [Tue, 23 May 2023 02:48:04 +0000 (19:48 -0700)]
update vaapi - vainfo
- add enable vainfo detection checkbox in config
- defined PT_DYN_INT to load integer field from function
- PT_DYN_INT must be paired with dyn_i
- show only VAAPI codecs advertised by vainfo
- defined two invisible fields: ui and uilp used for UI enable/disable features
- check if bitrate is greater than max_bitrate (fix to avoid tvh crash)
- vp8, vp9 separate Global Quality from Quality
- load quality and max B frames filters from vainfo
- UI has several constrains or warnings implemented using vainfo
- separated 'b_depth' from 'bf'
Allow setting a custom grace period for LinuxDVB adapters
When using Astrometa to tune to DVB-T2 muxes in Poland, the scans are reported
as complete but the found services have zero elementary services due to the scan
period being too short in order to fetch PMTs.
This change allows overriding the default grace period of 5 seconds with a
custom value. I successfully scanned all services with this setting changed to
15 for this particular adapter/mux combination.
Claudio [Thu, 23 May 2024 21:53:01 +0000 (23:53 +0200)]
Extend CORS origin help/hover message
Clarify that the value should be a URL, prefixed with http:// or https://, and not "bare" domains, which currently silently fail to save. Fixes (partially) #1700.