[vlc-commits] [Git][videolan/vlc][master] 2 commits: adaptive: fix normal time error code

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jan 24 17:18:46 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
07b0f01f by Alaric Senat at 2024-01-24T17:02:38+00:00
adaptive: fix normal time error code

Returning `VLC_TICK_INVALID` will actually pass as a success as it is
currently defined as 0.

- - - - -
9884290f by Alaric Senat at 2024-01-24T17:02:38+00:00
adaptive: use malloc for HTTP resources

Fix an allocator mismatch for HTTP resources. They are destroyed via a
free call in the C API via the `vlc_http_res_destroy` function.

- - - - -


2 changed files:

- modules/demux/adaptive/PlaylistManager.cpp
- modules/demux/adaptive/http/HTTPConnection.cpp


Changes:

=====================================
modules/demux/adaptive/PlaylistManager.cpp
=====================================
@@ -605,7 +605,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
         {
             vlc_mutex_locker locker(&cached.lock);
             if( cached.i_normaltime == VLC_TICK_INVALID )
-                return VLC_TICK_INVALID;
+                return VLC_EGENERIC;
             *(va_arg (args, vlc_tick_t *)) = cached.i_normaltime;
             break;
         }


=====================================
modules/demux/adaptive/http/HTTPConnection.cpp
=====================================
@@ -193,14 +193,18 @@ class adaptive::http::LibVLCHTTPSource : public adaptive::AbstractSource
         int create(const char *uri,const std::string &ua,
                    const std::string &ref, const BytesRange &range)
         {
-            struct restuple *tpl = new struct restuple;
+            auto *tpl = static_cast<struct restuple *>(
+                std::malloc(sizeof(struct restuple)));
+            if (unlikely(tpl == nullptr))
+                return -1;
+
             tpl->source = this;
             this->range = range;
             if (vlc_http_res_init(&tpl->resource, &this->callbacks, http_mgr, uri,
                                   ua.empty() ? nullptr : ua.c_str(),
                                   ref.empty() ? nullptr : ref.c_str()))
             {
-                delete tpl;
+                std::free(tpl);
                 return -1;
             }
             http_res = &tpl->resource;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/877450dc625056745a844b001346cc6c181bee79...9884290f8aa37635abee6375f3329b99ecc7a567

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/877450dc625056745a844b001346cc6c181bee79...9884290f8aa37635abee6375f3329b99ecc7a567
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list