Skip to content
Snippets Groups Projects
  1. Jan 26, 2024
    • Romain Vimont's avatar
      cli: fix possible uninitialized read · b7eeec2c
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      On Android:
      
          ../../modules/control/cli/cli.c:335:9: warning: variable 'ret' is
                  used uninitialized whenever 'if' condition is false
                  [-Wsometimes-uninitialized]
              if (count > 0)
                  ^~~~~~~~~
          ../../modules/control/cli/cli.c:359:12: note: uninitialized uses
                  occurs here
              return ret;
                     ^~~
      
      Return an error if count == 0 in the `#ifdef HAVE_WORDEXP` branch, and
      replace the if-condition by an assertion.
      b7eeec2c
  2. Nov 28, 2023
  3. Jul 21, 2023
    • Romain Vimont's avatar
      Fix extra tool error message · 8449690b
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      The error message is printed (among others) when the major versions
      differ, not only when the current version is older than the expected
      one, so "too old" may be incorrect.
      
      Before:
      
      > meson too old
      
      After:
      
      > meson incompatible version (expected 0.51.1, got 1.1.1)
      8449690b
  4. Jun 02, 2023
  5. Feb 14, 2023
    • Romain Vimont's avatar
      opengl: accept vout format change · adcec0ed
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      If the core requests to change the vout format (because it added filters
      having a different format), recreate the interop and the filters to
      accept the new format without an additional converter.
      adcec0ed
    • Romain Vimont's avatar
      vout: update format only if chroma changed alone · 4da11af9
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      The core is not ready to support size changes via the "update format"
      mechanism.
      
      Attempt to update the vout format only when the only difference between
      the old and new format is the chroma.
      
      Refs #1021
      4da11af9
    • Romain Vimont's avatar
      vout: update format after filters · e831af37
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      
      The vout is created first, based on the input format. Then filters
      (filter_t) could be added, possibly producing pictures in a different
      format.
      
            input ---> filters --->    MISMATCH    [I420] vout
                  I420         RGBA
      
      To avoid a mismatch between the output of the last filter and the
      expected format of the vout input, a converter was added when necessary
      to compensate:
      
            input ---> filters ---> converter ---> [I420] vout
                  I420         RGBA           I420
      
      But this was often a waste, and it caused problems for opaque formats.
      
      Instead, request the vout to adapt itself to the actual format produced
      by the last filter. If it can, we can avoid an additional converter.
      
            input ---> filters --->    MISMATCH    [I420] vout
                  I420         RGBA
      
            input ---> filters ------------------> [RGBA] vout
                  I420         RGBA
      
      If the vout does not support the new format (or does not accept to
      update its format), a converter is still added like before.
      
      Co-authored-by: Alexandre Janniaux's avatarAlexandre Janniaux <ajanni@videolabs.io>
      e831af37
    • Romain Vimont's avatar
      opengl: interop: hold video context · 0095945c
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      The video context must not be destroyed while the interop is alive.
      0095945c
  6. Feb 11, 2023
    • Romain Vimont's avatar
      vlc_vector: assert count argument is not 0 · 5ebf9e28
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      Several vlc_vector functions must not be called with count == 0:
       - it's useless (e.g. pushing 0 items to a vector)
       - with the current implementation, it can cause memcpy() to be called
         to copy 0 bytes (useless) with NULL pointer for the src parameter
         (triggers an error in ASAN).
      5ebf9e28
    • Romain Vimont's avatar
      randomizer: do not pass NULL to memcpy() · 279758e3
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      When switching playback order from NORMAL to RANDOM, the current
      playlist items are added to the randomizer.
      
      However, if the playlist is empty, the items vector is empty, and its
      .data field is NULL. This causes the following error in ASAN:
      
          ../../src/playlist/randomizer.c:426:10: runtime error: null pointer
          passed as argument 2, which is declared to never be null
      
      If the playlist size is 0, then do not call randomizer_Add() at all.
      279758e3
  7. Feb 10, 2023
    • Romain Vimont's avatar
      playlist: use stable sort · 4fdd351c
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      An unstable sort may confuse users.
      
      Since we already create a full array of items with their metadata before
      sorting, adding the initial index as an additional criteria is almost
      free.
      
      Fixes #27783
      4fdd351c
  8. Jan 23, 2023
    • Romain Vimont's avatar
      compat: fix jrand48() · a632b0df
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      According to the manpage, jrand48() must return a signed long integer
      uniformly distributed over the interval [-2^31, 2^31).
      
      The old implementation first computed iterate48(), which returns a
      positive 48-bit integer (as 'uint64_t', then cast to 'int64_t'). Once
      right-shifted by 16 bits, the result is guaranteed to be a 32-bit
      positive integer as 'int64_t'.
      
      It is then (implicitly) cast to 'long' to match the return type.
      
      When the 32th bit is 0 (i.e. the value fits in 31-bit), then everything
      is ok. However, when the 32nd bit is 1, then there are two cases (which
      are both incorrect):
       - if the 'long' type is 32-bit on the platform, then conversion from
         'int64_t' to 'long' is undefined;
       - if the 'long' type is more than 32-bit, then the resulting value will
         be a positive integer in the interval [0, 2^32), whereas jrand48()
         must return a value in the interval [-2^31, 2^31).
      a632b0df
  9. Nov 30, 2022
  10. Nov 26, 2022
  11. Nov 23, 2022
  12. Oct 11, 2022
    • Romain Vimont's avatar
      qt: refactor media tree listener · 7cc8e707
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      This C++ listener is actually a wrapper over a media tree listener, not
      a media source listener.
      
      This allows to make NetworkMediaModel independent of media sources, so
      that it can be reused with only a media tree not linked to a media
      source.
      
      NetworkDeviceModel, which still requires a media source, stores it in
      its listener callbacks implementation (ListenerCb).
      7cc8e707
    • Romain Vimont's avatar
      qt: avoid unnecessary smart pointer copies · b9552485
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      b9552485
    • Romain Vimont's avatar
      qt: remove unused mediaSource · 104fa8e8
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      Only NetworkDeviceModel need to expose a mediaSource. The mediaSource
      was forwarded to all media item, but it is never used, so remove it.
      
      This paves the way to make NetworkMediaModel independent of media
      sources.
      104fa8e8
    • Romain Vimont's avatar
      qt: remove unused include · baacc656
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      baacc656
    • Romain Vimont's avatar
      qt: use one "callbacks" instance per listener · eae4b0c0
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      For each model (NetworkDeviceModel and NetworkMediaModel), every
      NetworkSourceListener instance were created with the same
      SourceListenercb instance:
      
         +------------------+
         | SourceListenerCb |-----------------------------.
         +------------------+                             |
                 ^                                        |
                 | implements                             |
        +--------------------+                            |
        | NetworkDeviceModel |                            |
        +--------------------+                            |
                 | m_listeners                            |
               +---+            +-----------------------+ |
               | ---------------| NetworkSourceListener |-|
               +---+            +-----------------------+ |
               | ----------     +-----------------------+ |
               +---+       `----| NetworkSourceListener |-|
               | -------...     +-----------------------+ .
               +---+                                      .
               |   |                                      .
               +---+
      
      To prepare storing additional data for each registration, use one
      SourceListenerCb instance per listener:
      
                                                        +------------------+
                                                        | SourceListenerCb |
                                                        +------------------+
                                                                         ^
                                                              implements |
        +--------------------+                                           |
        | NetworkDeviceModel |                                           |
        +--------------------+                                           |
                 | m_listeners                                           |
               +---+         +-----------------------+  +--------------+ |
               | ------------| NetworkSourceListener |--| MyListenerCb |-|
               +---+         +-----------------------+  +--------------+ |
               | ----------  +-----------------------+  +--------------+ |
               +---+       `-| NetworkSourceListener |--| MyListenerCb |-|
               | -------...  +-----------------------+  +--------------+ .
               +---+                                                     .
               |   |                                                     .
               +---+
      
      In practice, this will allow the SourceListenerCb (to be renamed to
      MediaTreeListenerCb) to only use a media tree (not a media source), and
      let the caller store an additional associated media source usable
      from the callbacks implementation.
      
      As a drawback, the MyListenerCb instance must be owned by the listener
      (to avoid additional complexity on the client side), but then this
      forces the client to always create a separate class for the listener
      callbacks, even when not necessary (i.e. making NetworkMediaModel
      "implement" SourceListenerCb is not possible anymore).
      
      Alternatives considered:
       1. keep SourceListenerCb as is, but make NetworkSourceListener virtual
          (inheritable), so that the additional media source could be stored
          there. As a drawback, the SourceListenerCb methods would need to get
          the NetworkSourceListener instance as parameter (so yet another
          indirection). And having both the listener and the callbacks virtual
          seems odd.
       2. merge SourceListenerCb into NetworkSourceListener, so that the
          client can just inherit and store additional private data in the
          same class. But this requires more changes from the existing code
          base.
      eae4b0c0
    • Romain Vimont's avatar
      qt: use static free functions for C callbacks · 1a9ab8b5
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      Callbacks to be called from C should be free functions rather than class
      members.
      1a9ab8b5
    • Romain Vimont's avatar
      qt: remove unnecessary explicit destructor · 0aeafa2d
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      0aeafa2d
    • Romain Vimont's avatar
      qt: remove unused default constructor · 07fc99b9
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      07fc99b9
    • Romain Vimont's avatar
      media tree: make functions public · c808e3e8
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      This will allow to create and handle a media tree separately from a
      media source (linked to a service discovery).
      c808e3e8
  13. Oct 04, 2022
    • Romain Vimont's avatar
      hotkeys: do not take snapshots from the UI thread · b3ccc7b0
      Romain Vimont authored and Rémi Denis-Courmont's avatar Rémi Denis-Courmont committed
      Snapshots are performed via a call to:
      
          var_TriggerCallback("video-snapshot")
      
      causing its callback (SnapshotCallback) to be called synchronously,
      executing the following steps:
       - wait for the vout thread to actually capture the (next) frame;
       - encode the picture to PNG;
       - write the result to disk (I/O).
      
      Since var_TriggerCallback("video-snapshot") is called from the UI
      thread, all these blocking actions are also performed on the UI thread.
      
      Move the call to a separate thread.
      b3ccc7b0
    • Romain Vimont's avatar
      qt: do not take snapshots from the UI thread · 1aa5ca65
      Romain Vimont authored and Rémi Denis-Courmont's avatar Rémi Denis-Courmont committed
      Snapshots are performed via a call to:
      
          var_TriggerCallback("video-snapshot")
      
      causing its callback (SnapshotCallback) to be called synchronously,
      executing the following steps:
       - wait for the vout thread to actually capture the (next) frame;
       - encode the picture to PNG;
       - write the result to disk (I/O).
      
      Since var_TriggerCallback("video-snapshot") is called from the UI
      thread, all these blocking actions are also performed on the UI thread.
      
      Move the call to a separate thread.
      1aa5ca65
  14. Oct 01, 2022
    • Romain Vimont's avatar
      vlc_shared_data_ptr: accept implicit ctor for null · 98d7763c
      Romain Vimont authored and Steve Lhomme's avatar Steve Lhomme committed
      The main constructor, accepting a pointer, is explicit:
      
          my_ptr_type *p = ...;
          MySharedPtr ptr = p;   /* invalid */
          MySharedPtr ptr{ p };  /* ok */
      
      This prevents to mistakenly assign a pointer to a shared pointer.
      
      However, assignment to nullptr should be acceptable:
      
          MySharedPtr ptr = nullptr;  /* should be ok */
      98d7763c
  15. Sep 29, 2022
  16. Aug 08, 2022
    • Romain Vimont's avatar
      vout: re-render ASAP after interruption · 37d7278d
      Romain Vimont authored and Denis Charmet's avatar Denis Charmet committed
      If vlc_clock_Wait() has been interrupted to release the display_lock
      quickly, then the next rendering must be performed ASAP, without waiting
      for any deadline.
      37d7278d
    • Romain Vimont's avatar
      vout: interrupt wait on UI resize request · 316fb563
      Romain Vimont authored and Denis Charmet's avatar Denis Charmet committed
      On resize, the UI thread waits for the end of any current rendering at
      the old size before returning.
      
      To limit its waiting, interrupt the wait between prepare() and display()
      on the vout thread to complete the rendering as soon as possible. As a
      consequence, the display() call might be performed early (before its
      expected PTS).
      
      Refs !324
      316fb563
  17. May 04, 2022
    • Romain Vimont's avatar
      rtp: fix initialization · d651ee5b
      Romain Vimont authored and Romain Vimont's avatar Romain Vimont committed
      The pointer pt->opaque was initialized only under some conditions in
      rtp_h264_open(), but its value was used unconditionnaly in
      rtp_h264_init().
      
      Reported by ASAN.
      d651ee5b
  18. May 03, 2022
  19. Apr 29, 2022
Loading