1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00
Commit Graph

1850 Commits

Author SHA1 Message Date
Marvin Scholz
90d73cd561 auhal: remove useless assignment 2021-04-27 17:32:05 +00:00
Marvin Scholz
c66ac48588 auhal: clarify usage for tick/host conversion helpers 2021-04-27 17:32:05 +00:00
Marvin Scholz
91e8de2ce8 auhal: fix types and names of frames to ticks conversion 2021-04-27 17:32:05 +00:00
Marvin Scholz
e1ca9f5a6e auhal: minor code-style changes 2021-04-27 17:32:05 +00:00
Marvin Scholz
d5eea6d206 auhal: do not return OSStatus directly from VolumeSet
We can't assume OSStatus is always an int.
2021-04-27 17:32:05 +00:00
Marvin Scholz
65eb38f15b auhal: use constants instead of magic fourccs 2021-04-27 17:32:05 +00:00
Marvin Scholz
050c788d2b auhal: use #include instead of #import in C files 2021-04-27 17:32:05 +00:00
Francois Cartegnie
408a9547db vlc_codecs: fix twocc mmreg.h collisions 2021-02-09 18:51:29 +01:00
Rémi Denis-Courmont
bab6469b0a Revert "pulse: use pa_stream_begin_write()" (fixes #25187)
Contrary to claims in the commit message, it introduces an extra memory
copy of all audio samples for no apparent reasons.

This reverts commit 0bdc7268dc.
2021-02-08 17:14:13 +02:00
Zhao Zhili
e4ff5993e2 android: utils: build utils as a lib
Make other targets depend on libandroid_utils instead of duplicate
the source code.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2021-02-01 11:50:47 +01:00
Zhao Zhili
088c787680 opensles_android: report mute state
Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2021-02-01 11:39:40 +01:00
Thomas Guillem
9c3fe6ad2e audiotrack: refactor
Move special hack and deadline handling just after the write call.

No functional changes.
2020-12-01 12:16:05 +01:00
Thomas Guillem
ee40cfa0fa audiotrack: remove special handling of spurious wakeup
All code surrounding cond vars already handle spurious wakeup, there is
no need for that extra variable.
2020-12-01 12:16:05 +01:00
Thomas Guillem
66cfbf1f9d audiotrack: rename Play*() to Write*() 2020-12-01 12:16:05 +01:00
Thomas Guillem
1172edd04e audiotrack: remove useless play_time
This was mainly used for a previous hack.
2020-12-01 12:16:05 +01:00
Thomas Guillem
aa5eb1e02f audiotrack: clip the buffer size 2020-12-01 12:16:05 +01:00
Thomas Guillem
ce763c7541 audiotracy: always request the timestamp during the syncing phase
Don't wait 500ms between 2 requests if we don't have a valid timestamp.
2020-12-01 12:16:05 +01:00
Thomas Guillem
a726098adb audiotrack: wrap arround AudioTimestamp.framePosition
cf. https://developer.android.com/reference/android/media/AudioTimestamp#framePosition
2020-12-01 12:16:05 +01:00
Thomas Guillem
fef7f47672 audiotrack: rename function 2020-12-01 12:16:05 +01:00
Thomas Guillem
9d7e1825be audiotrack: avoid cast, use proper type 2020-12-01 12:16:05 +01:00
Thomas Guillem
61aca1f240 audiotrack: use an up to date buffer size
The size returned by this new method should not be different than the
one when used to configure audiotrack. Theoretically, it can be bigger.
2020-12-01 12:16:05 +01:00
Thomas Guillem
bf960b3679 audiotrack: handle getPlaybackheadPosition() invalid values 2020-12-01 12:16:05 +01:00
Thomas Guillem
560221d662 audiotrack: use AudioTrack.getLatency()
Instead of AudioSystem.getOutputLatency().

That way, we are sure the get the latency of the current output device.

Note: both methods are hidden and should not be used in favor or
AudioTrack.getTimestamp(). Unfortunately, getTimestamp() returns a valid
timestamp too late (after few seconds) or doesn't work with some phones.
Therefore, the usage of the hidden API is still needed as a backup plan.

cf. https://github.com/google/ExoPlayer/issues/5763

The android team allow the usage of this hidden API, waiting for a new
method in next Android versions.
2020-12-01 12:16:05 +01:00
Thomas Guillem
77ddd210ba audiotrack: rework delay logs 2020-12-01 12:16:05 +01:00
Thomas Guillem
9257d8a3f4 mmdevice: don't request gain from Open()
If "--volume-save" == false, then the volume is set from Open(),
therefore a gain is requested causing the vlc_mutex_assert() in
aout_GainNotify().

The gain should be notified from any aout callbacks, but not from the
Open().
2020-11-30 09:35:49 +01:00
Steve Lhomme
5d14661389 audio_output/mmdevice: report the mute status after it is set 2020-11-25 07:19:13 +01:00
Steve Lhomme
a300249e98 audio_output/winstore: report the default device to the core
For now we don't list other devices
2020-11-25 07:19:13 +01:00
Steve Lhomme
d104faec19 audio_output/winstore: report the volume changes
After a mute it seems we need to tell report the new volume otherwise it
assumes it's 0.

We keep the gain so we can compute the proper volume to report on mute.
2020-11-25 07:19:13 +01:00
Steve Lhomme
27bf537c7d audio_output/winstore: report the mute status when it was set successfully 2020-11-25 07:19:06 +01:00
Steve Lhomme
5f17d0a79d audio_output/winstore: do the MTA+lock before setting the initial device
The requested device is set to the default one in Open and requires the MTA
setup in order for the activation to work. Otherwise it deadlocks.
2020-11-25 07:19:06 +01:00
Steve Lhomme
4bc2b28f0a audio_output/winstore: fix free of the default device
It must be free'd with CoTaskMemFree and only once.
2020-11-25 07:19:06 +01:00
Thomas Guillem
61037b6369 coreaudio: fix play of uninitialized data (loud CRACK)
When starting deferred (likely), ca_Render() is filling the output
buffer with 0s (silence) until the requested start time is reached. When
the host time is near the requested start time, the output buffer is
partially filled with 0s, and partially filled with valid data.

In that particular case, the output buffer offset was not updated
causing the valid data to be copied at the beginning of the output
buffer, leaving some uninitialized data at the end of the buffer.

Fixes #25142

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2020-10-10 00:48:21 +02:00
Rémi Denis-Courmont
b114c5ebd9 afile: use size_t for array size 2020-09-24 21:39:32 +03:00
Lyndon Brown
ae6af4007e afile: check equality, not starts with
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2020-09-24 21:39:32 +03:00
Alexandre Janniaux
40e8883b4d audio_output: coreaudio: match return type
The function is returning size_t so store in size_t too.
2020-08-18 15:07:20 +02:00
Alexandre Janniaux
c7a440a207 audio_output: coreaudio: use int64_t for host time
The computation was leading to very high render_delay (for example in
some measurement, render_delay = 6148914691236500), and so glitch during
playback with for instance the following warnings:

    libvlc video output warning: picture is too late to be displayed
    (missing 4279998112535367 ms)

Instead, use int64_t for computations. Unsignedness is kept for
computation on frames / bytes and for storing the initial host_time.
2020-08-18 15:07:20 +02:00
Thomas Guillem
9353448cd4 auhal: fix wrong host time with SPDIF render callbacks
This caused a freeze as the aout returned infinite values from time_get() with
SPDIF output.

Indeed, the inNow time is in the past (time when the callback is executed) and
a substraction with mach_absolute_time() returned a negative value.

The issue is revealed by 303d12153f but the
SPDIF host time had always been wrong.
2020-07-22 09:52:01 +02:00
Steve Lhomme
c4ad40650d aout: winstore: report the device in use 2020-07-06 13:35:29 +02:00
Steve Lhomme
32349b35de aout: winstore: select the audio output using ActivateAudioInterfaceAsync
See the API https://docs.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-activateaudiointerfaceasync

It requires a recent mingw-w64 with the added API.

We request the IAudioClient asynchronously and return the found client or NULL
once the async call as completed.
The code originates from the vlc-winrt project with some modifications.

Do not rely anymore on the local "winstore-client" variable to cache the
IAudioClient. A client is queried/used between each Start/Stop calls.
2020-07-06 13:35:29 +02:00
Steve Lhomme
d0b5eb1c91 aout: winstore: rename vlc_FromHR to ResetInvalidatedClient
And some more cleaning
2020-07-06 13:34:24 +02:00
Thomas Guillem
1530679a64 coreaudio: fix possible freeze after pause, seek, unpause
After a flush, i_first_render_host_time is reset to 0 and i_render_host_time
should not be touched since the playback has not started again yet. This caused
the i_first_render_host_time to be never setup.

Regression from f9fce13591
Fixes #24876
2020-06-23 16:33:14 +02:00
Steve Lhomme
17b13a2450 aout: wasapi: use a vlc_timer for the deferred start
The timer API is not supported in Winstore builds so switch to something that
works for all.

The timer (thread based) is created once and armed/disarmed when needed.
2020-06-11 15:18:47 +02:00
Thomas Guillem
f9fce13591 coreaudio: fix invalid delay after a unpause
The render host time was not updated while paused.

This caused the first time_get(), after a unpause, to return a delay way too
early (corresponding to the pause time). This could happen only when the ca
render callback was not triggered between an unpause and a time_get.

This invalid delay caused the insertion of a long silence, that was not
interruptible, hence the impression of a deadlock.

Fixes #24668
2020-05-24 20:59:35 +02:00
Alexandre Janniaux
e69c8fbacd audio_output: Makefile.am: fix audiounit_ios link
Remove AudioUnit framework as it is not found on iOS and only
AudioToolbox is needed.

In addition CoreServices cannot be linked for the iOS/tvOS targets as it
is available starting with iOS/tvOS 12.0+.
2020-05-19 16:20:53 +02:00
Steve Lhomme
81d3212ab1 aout: winstore: fix compilation
Broken since
Revision: fd04c9b2fa
Author: Thomas Guillem <thomas@gllm.fr>
Date: 2019-09-27 17:02:53
Message:
mmdevice: pass play date to streams
2020-04-08 14:53:19 +02:00
Thomas Guillem
303d12153f coreaudio: fix calculation when the clock sources are different
As MONOTONIC is defined by POSIX to be the one that ticks during sleep while
mach absolute time does not.

For now (and for 3.0) vlc_tick_now() has the same source than the mach one.
2020-04-01 10:44:49 +02:00
Alexandre Janniaux
8184a49986 opensles_android: fix integer print format
SLresult is defined as an SLuint32 and might not be represented as an
unsigned long int. It is raising warnings when compiling for android
aarch64, so cast it to ensure it's an uint32_t and display it with
PRIu32 instead.

block_t->i_buffer is size_t too and must be displayed with %zu.
2020-03-30 09:16:08 +02:00
Rémi Denis-Courmont
3906d0e0d7 Remove/substitute useless vlc_atomic.h include 2020-02-27 22:37:24 +02:00
Marvin Scholz
b13c3c10d6 aout/coreaudio: use vlc_mutex_t instead of pthread_mutex_t
The fact that currently vlc_mutex_t is the same as pthread_mutex_t
is an implementation detail, there is no reason not to use vlc_mutex_t
here.
2020-02-24 14:56:34 +01:00
Rémi Denis-Courmont
a18c4d6570 thread: remove vlc_cond_destroy() 2020-02-21 19:17:53 +02:00