Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
442f18fe
Commit
442f18fe
authored
Oct 26, 2015
by
Hugo Beauzée-Luyssen
Browse files
VLCThumbnailer: Avoid potential useless buffer reallocations
parent
8f98f62c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/metadata_services/vlc/VLCThumbnailer.cpp
View file @
442f18fe
...
...
@@ -41,6 +41,7 @@ VLCThumbnailer::VLCThumbnailer(const VLC::Instance &vlc)
#endif
,
m_snapshotRequired
(
false
)
,
m_height
(
0
)
,
m_prevSize
(
0
)
{
#ifdef WITH_EVAS
static
int
fakeBuffer
;
...
...
@@ -184,12 +185,13 @@ void VLCThumbnailer::setupVout( VLC::MediaPlayer& mp )
const
float
inputAR
=
(
float
)
*
width
/
*
height
;
*
width
=
Width
;
auto
prevHeight
=
m_height
;
m_height
=
(
float
)
Width
/
inputAR
+
1
;
auto
size
=
Width
*
m_height
*
Bpp
;
// If our buffer isn't enough anymore, reallocate a new one.
if
(
m_height
>
prev
Height
)
if
(
size
>
m_
prev
Size
)
{
m_buff
.
reset
(
new
uint8_t
[
Width
*
m_height
*
Bpp
]
);
m_buff
.
reset
(
new
uint8_t
[
size
]
);
m_prevSize
=
size
;
}
*
height
=
m_height
;
*
pitches
=
Width
*
Bpp
;
...
...
src/metadata_services/vlc/VLCThumbnailer.h
View file @
442f18fe
...
...
@@ -66,4 +66,5 @@ private:
std
::
unique_ptr
<
uint8_t
[]
>
m_buff
;
std
::
atomic_bool
m_snapshotRequired
;
uint32_t
m_height
;
uint32_t
m_prevSize
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment