1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-04 09:11:33 +02:00
Commit Graph

47617 Commits

Author SHA1 Message Date
Thomas Guillem
6c9f07a9ed pulse: calculate the start time from the last date played
stream_latency_cb() is needed to re-calculate the new derrered time (or start
late in the worst case scenario) when the audio device latency changes.

This callback called stream_start() with the first played system date. The
problem is that the delta calculated from stream_start was always late. Using
the last system date seems more logical. Indeed, the delta need to be
calculated from values using the same reference point (and vlc_pa_get_latency()
is calculated from the amount of buffers played).

This issue could be easily reproduced when the first played date was more than
100ms in the future, by using --audio-desync 100 for example.

This issue was not visible in most cases, because the deferred time is small by
default (10ms) and because the stream_latency_cb is often triggered after this
time.

Here are some logs to illustrate this (I added logs that print the played block
pts, the delay since the first play and when the stream_latency_cb is called).

 * Logs without this patch when running vlc with "--audio-desync 100":

Play @110959, first play since 0us
[0000617000008d50] pulse audio output warning: cannot synchronize start
[0000617000008d50] pulse audio output warning: deferring start (110903 us)
Play @142466, first play since 493us
[0000617000008d50] pulse audio output warning: deferring start (110460 us)
Play @174193, first play since 766us
[0000617000008d50] pulse audio output warning: deferring start (110188 us)
Play @205943, first play since 1016us
[0000617000008d50] pulse audio output warning: deferring start (109937 us)
Play @237698, first play since 1261us
[0000617000008d50] pulse audio output warning: deferring start (109692 us)
Play @269435, first play since 1524us
[0000617000008d50] pulse audio output warning: deferring start (109430 us)
Play @301150, first play since 1809us
[0000617000008d50] pulse audio output warning: deferring start (109144 us)
Play @332900, first play since 2059us
[0000617000008d50] pulse audio output warning: deferring start (108895 us)
Play @364648, first play since 2311us
[0000617000008d50] pulse audio output warning: deferring start (108643 us)
Play @396354, first play since 2605us
[0000617000008d50] pulse audio output warning: deferring start (108349 us)
Play @428076, first play since 2883us
[0000617000008d50] pulse audio output warning: deferring start (108069 us)
Play @459788, first play since 3171us
[0000617000008d50] pulse audio output warning: deferring start (107783 us)
Play @491531, first play since 3428us
[0000617000008d50] pulse audio output warning: deferring start (107526 us)
Play @523276, first play since 3683us
[0000617000008d50] pulse audio output warning: deferring start (107271 us)
Play @555026, first play since 3933us
[0000617000008d50] pulse audio output warning: deferring start (107020 us)
stream_latency_cb
[0000617000008d50] pulse audio output warning: starting late (-396346 us)
starting since: 27318
[0000617000008d50] pulse audio output warning: started
[0000617000008d50] main audio output warning: playback too early (-78075): down-sampling

 * Logs with this patch when running vlc with "--audio-desync 100":

Play @110978, first play since 0us
[000055e7c506d030] pulse audio output warning: cannot synchronize start
[000055e7c506d030] pulse audio output warning: deferring start (110952 us)
Play @142708, first play since 270us
[000055e7c506d030] pulse audio output warning: deferring start (110699 us)
Play @174601, first play since 377us
[000055e7c506d030] pulse audio output warning: deferring start (110597 us)
Play @206446, first play since 532us
[000055e7c506d030] pulse audio output warning: deferring start (110443 us)
Play @238302, first play since 676us
[000055e7c506d030] pulse audio output warning: deferring start (110298 us)
Play @270173, first play since 805us
[000055e7c506d030] pulse audio output warning: deferring start (110151 us)
Play @302008, first play since 970us
[000055e7c506d030] pulse audio output warning: deferring start (110005 us)
Play @333914, first play since 1064us
[000055e7c506d030] pulse audio output warning: deferring start (109911 us)
Play @365818, first play since 1160us
[000055e7c506d030] pulse audio output warning: deferring start (109814 us)
Play @397712, first play since 1266us
[000055e7c506d030] pulse audio output warning: deferring start (109708 us)
Play @429588, first play since 1390us
[000055e7c506d030] pulse audio output warning: deferring start (109584 us)
Play @461489, first play since 1489us
[000055e7c506d030] pulse audio output warning: deferring start (109485 us)
Play @493351, first play since 1627us
[000055e7c506d030] pulse audio output warning: deferring start (109347 us)
Play @525261, first play since 1717us
[000055e7c506d030] pulse audio output warning: deferring start (109257 us)
Play @557173, first play since 1805us
[000055e7c506d030] pulse audio output warning: deferring start (109169 us)
stream_latency_cb
[000055e7c506d030] pulse audio output warning: deferring start (74793 us)
Play @555762, first play since 35216us
[000055e7c506d030] pulse audio output warning: deferring start (75748 us)
Play @587642, first play since 35336us
[000055e7c506d030] pulse audio output warning: deferring start (75637 us)
Play @619520, first play since 35458us
[000055e7c506d030] pulse audio output warning: deferring start (75516 us)
Play @651428, first play since 35550us
[000055e7c506d030] pulse audio output warning: deferring start (75425 us)
Play @683305, first play since 35673us
[000055e7c506d030] pulse audio output warning: deferring start (75302 us)
Play @715187, first play since 35791us
[000055e7c506d030] pulse audio output warning: deferring start (75183 us)
Play @747067, first play since 35911us
[000055e7c506d030] pulse audio output warning: deferring start (75063 us)
Play @778930, first play since 36048us
[000055e7c506d030] pulse audio output warning: deferring start (74926 us)
stream_latency_cb
[000055e7c506d030] pulse audio output warning: deferring start (34708 us)
[000055e7c506d030] pulse audio output warning: starting deferred
starting since: 79393
[000055e7c506d030] pulse audio output warning: started

You can see, with this patch, that the resampler is not triggered anymore and
that the stream really start after 100ms (79393 + pulse latency).

In both case, audio and video have the same delay, but in the first case,
the core had to correct it (by playing silence or with the resampler).
2019-01-23 15:31:58 +01:00
Francois Cartegnie
0d6a31dcda demux: dash: handle infinite repeat in timeline
no spec... guessing
2019-01-23 13:14:02 +01:00
Francois Cartegnie
7256300850 demux: dash: only refresh Live MPD on minUpdatePeriod 2019-01-23 12:23:42 +01:00
Francois Cartegnie
00061db7bb demux: adaptive: add needsUpdate playlist property 2019-01-23 12:23:42 +01:00
Francois Cartegnie
cefbd1fc31 demux: dash: decl parser as friend class 2019-01-23 12:23:35 +01:00
Hugo Beauzée-Luyssen
244c1c2229 medialibrary: Fix TOCTOU when accesing mrls 2019-01-23 11:05:16 +01:00
Hugo Beauzée-Luyssen
6da3414bce medialibrary: metadata extractor: Handle timeouts 2019-01-23 11:05:16 +01:00
Hugo Beauzée-Luyssen
ab48d9e513 medialibrary: Add a VLC_ML_IS_INDEXED control 2019-01-23 11:05:16 +01:00
Hugo Beauzée-Luyssen
3c609c4ee9 medialibrary: Add an input_item_t from media getter 2019-01-23 11:05:16 +01:00
Hugo Beauzée-Luyssen
ad6c3cd6dd medialibrary: Don't assume query to be non-null 2019-01-23 10:01:17 +01:00
Hugo Beauzée-Luyssen
d79805c5fe sd: avahi: Fix potential use after free
A SD user might want to use the fields of the removed item, which can't
be done if it gets released immediatly after being sent.
2019-01-23 10:01:17 +01:00
Steve Lhomme
472f20695a direct3d11: move the windowed/windowless output format selection in a functions 2019-01-22 13:21:19 +01:00
Steve Lhomme
5b6a6ca961 direct3d11: don't use the winstore swapchain if not in windowless mode
the winstore build doesn't work in windowed mode
2019-01-22 13:17:59 +01:00
Steve Lhomme
0ee25b9228 direct3d1: don't use the module in winstore builds if there's no context
It only works in windowless mode
2019-01-22 13:10:34 +01:00
Steve Lhomme
265c8d7ab4 direct3d11: fix warnings
COLOR_RANGE_STUDIO is now defined in vlc_es
hr is shadowing the other HRESULT
2019-01-22 13:10:33 +01:00
Steve Lhomme
9828378c85 direct3d11: move some code 2019-01-22 13:10:33 +01:00
Francois Cartegnie
5a335557bc access: bluray: fix PG range 2019-01-21 19:18:41 +01:00
Francois Cartegnie
4a9dc2a626 access: bluray: process stream selection event last
playlist info is not available yet and the stream selection
has no longer access to parent p_sys
2019-01-21 18:34:00 +01:00
Stefan Brüns
070060d181 avahi: Add support for chromecast renderer discovery
Allow discovery of chromecast devices with the Avahi DNS-SD resolver.
Tested with a Chromecast version 2 (Audio/Video).

See: #19921
https://forum.videolan.org/viewtopic.php?t=146211
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Stefan Brüns
da019696fb avahi: Prepare code for support of renderer discovery
Instead of passing the services_discovery_t as userdata for the callbacks,
use a struct discovery_sys_t which is common for both the input and renderer
private data structures.

The discovery_sys_t is embedded into the service type specific private
member structs, i.e. struct services_discovery_sys_t (done here) and
struct vlc_renderer_discovery_sys (next patch).

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Stefan Brüns
6d4afd268b avahi: Fix leaking AvahiServiceResolver in the error paths
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Stefan Brüns
aaba1daa26 avahi: Explicitly handle AVAHI_BROWSER_REMOVE events
name is only set for AVAHI_BROWSER_NEW and AVAHI_BROWSER_REMOVE. Explicitly
check for REMOVE instead of deducing the event type from the name being
set.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Thomas Guillem
b72f28f059 microdns: remove an unnecessary layer of struct 2019-01-21 14:31:40 +01:00
Thomas Guillem
04e0a5a2d3 renderer: make p_sys a void pointer 2019-01-21 14:31:40 +01:00
Thomas Guillem
ddfca8f5c1 bonjour: use an intermediate variable to access p_sys
And prepare for the next commit.
2019-01-21 14:31:40 +01:00
Thomas Guillem
9d70cdb4fb microdns: use an intermediate variable to access p_sys
And prepare for the next commit.
2019-01-21 14:31:40 +01:00
Marvin Scholz
4d5f4b1ccb vout/ios: Fix crash due to unexpected _eaglEnabled state
Fix videolan/VLCKit#221

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Marvin Scholz
89f6b1902f vout/ios: Fix leaks on initialization failure
Failing to initialize would not release the allocated self instance,
causing it to leak. Instead of the super dealloc just call release
on ourselves, this simplifies error handling too as dealloc takes
care of destroying the mutex and condition variables.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Marvin Scholz
405780b018 vout/ios: Remove unnecessary nil check
Sending a message to nil is valid, which makes this check
unnecessary.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Marvin Scholz
565d3e9c8e vout/ios: Rename confusingly named methods
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Marvin Scholz
f9c4af6e89 vout/ios: Simplify makeCurrentWithGL:withGL:
Return early when setCurrentContext fails, this simplifies
the following code and makes it much easier to read.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-21 14:31:40 +01:00
Francois Cartegnie
3deaf52e0f access: bluray: fix debug code 2019-01-21 12:05:04 +01:00
Rémi Denis-Courmont
a010b59b0b visual: use vout_Close() directly 2019-01-18 23:09:21 +02:00
Rémi Denis-Courmont
826dce64de goom: use vout_Close() directly 2019-01-18 23:09:07 +02:00
Rémi Denis-Courmont
01fcf9c1d1 aout: remove useless parameter to aout_FiltersNew() 2019-01-18 23:04:19 +02:00
Rémi Denis-Courmont
0ea1fd7f16 aout: always create visualization callbacks
This provides bug compatibility with the SDI stream output and, on
error, the transcode stream output, which were incorrectly passing
a non-NULL first parameter to aout_FiltersDelete().
2019-01-18 23:04:19 +02:00
Rémi Denis-Courmont
2c699bb6b5 transcode: add missing parameter to transcode_audio_clean()
Other ES type have it. This will be needed for audio later.
2019-01-18 23:04:19 +02:00
Rémi Denis-Courmont
16fb2fea16 visualization: split RequestVout in GetVout and PutVout 2019-01-18 23:04:19 +02:00
Martin Storsjö
8723305448 aarch64: Use the asm.S header and function macro for merge_sve.S
This fixes building the SVE code for other targets than ELF.
2019-01-18 22:29:48 +02:00
Devin Heitmueller
5856f6c692 decklink: Fix compile breakage on MacOS
The following commit broke compilation of the decklink modules on
OSX, since CFStringRef is already const.

commit 651c58b9b4
Author: Marvin Scholz <epirat07@gmail.com>
Date:   Mon Oct 22 09:27:21 2018 +0200

    Decklink: Use typedef instead of macro

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2019-01-18 17:40:05 +01:00
Thomas Guillem
4b7aea3a1e sout: chromecast: fix memory corruption
Don't write on the sub id that is not owned by this module.
2019-01-18 17:37:02 +01:00
Thomas Guillem
04e3a46cf9 sout: chromecast: fix seek after EOF
On EOF, the sout can receive one last block, the drained one. In that case,
GetSubId() will fail since the sout chain is already stopped (in order to
drain). The decoder_t error state was set to true in that case, and next flush
calls were ignored.

Yes, this is an other hack and the chromecast is always dropping the last
drained buffer (it was already the case before). For the moment, I can't find a
proper solution without modyfing heavily the demux filter API (so no 3.0
backport).
2019-01-18 15:29:06 +01:00
Steve Lhomme
ea5d602326 direct3d11: fix the first call to D3D11_SetupQuad()
It doesn't have the proper dimensions set in rect_src_clipped.
2019-01-18 14:46:09 +01:00
Steve Lhomme
cc5b976e2a direct3d9: add an option callback to be signaled when the scene/source size changes
To be used for "window less" rendering
2019-01-18 11:32:58 +01:00
Thomas Guillem
4ae7000264 upnp: set discovery less verbose 2019-01-18 10:59:18 +01:00
Thomas Guillem
e826934066 mux: avformat: simpler reset-ts implementation
Use oc->avoid_negative_ts that is available in ffmpeg and libav.

Fixes #21743
2019-01-18 10:26:05 +01:00
Johan Gunnarsson
981a31858f hw: vaapi: fix a few warnings
hw/vaapi/filters.c:296:9: warning: variable 'pipeline_buf' is used uninitialized whenever 'if' condition is true
      [-Wsometimes-uninitialized]
    if (vlc_vaapi_BeginPicture(VLC_OBJECT(filter),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:344:9: note: uninitialized use occurs here
    if (pipeline_buf != VA_INVALID_ID)
        ^~~~~~~~~~~~
hw/vaapi/filters.c:296:5: note: remove the 'if' if its condition is always false
    if (vlc_vaapi_BeginPicture(VLC_OBJECT(filter),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:292:9: warning: variable 'pipeline_buf' is used uninitialized whenever 'if' condition is true
      [-Wsometimes-uninitialized]
    if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:344:9: note: uninitialized use occurs here
    if (pipeline_buf != VA_INVALID_ID)
        ^~~~~~~~~~~~
hw/vaapi/filters.c:292:5: note: remove the 'if' if its condition is always false
    if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:285:9: warning: variable 'pipeline_buf' is used uninitialized whenever 'if' condition is true
      [-Wsometimes-uninitialized]
    if (vlc_vaapi_MapBuffer(VLC_OBJECT(filter), filter_sys->va.dpy,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:344:9: note: uninitialized use occurs here
    if (pipeline_buf != VA_INVALID_ID)
        ^~~~~~~~~~~~
hw/vaapi/filters.c:285:5: note: remove the 'if' if its condition is always false
    if (vlc_vaapi_MapBuffer(VLC_OBJECT(filter), filter_sys->va.dpy,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/vaapi/filters.c:304:5: note: variable 'pipeline_buf' is declared here
    VABufferID                          pipeline_buf = VA_INVALID_ID;
    ^
9 warnings generated.

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2019-01-18 08:36:34 +01:00
Rémi Denis-Courmont
17717547a4 avformat: missing cast, fix format 2019-01-17 18:56:07 +02:00
Steve Lhomme
78d3d6a3c6 remove stray $Id 2019-01-17 15:37:36 +01:00
Shaleen Jain
ce8b76c4ec sout: chromecast: fix regression
Before commit ec61edc0d0 chromecast depended on
vlc_sout_renderer_GetVcodecOption to signal the codec selected to transcode to.
Achieve that by introducing an output parameter where the codec used is
written.

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2019-01-17 13:09:31 +01:00