libvlc_video_take_snapshot memory leak?
Posted: 22 Nov 2010 15:23
Hi,
I have an application which plays a video stream and saves a png image to file every 1 sec by calling libvlc_video_take_snapshot.
I have noticed that over time the amount of memory consumed by my app increases at a linear rate.
Looking at the source code forlibvlc_video_take_snapshot , a call to vlc_object_release (p_vout) is never made before we exit the method?
139 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
140 const char *psz_filepath,
141 unsigned int i_width, unsigned int i_height )
142 {
143 assert( psz_filepath );
144
145 vout_thread_t *p_vout = GetVout (p_mi, num);
146 if (p_vout == NULL)
147 return -1;
148
149 /* FIXME: This is not atomic. Someone else could change the values,
150 * at least in theory. */
151 var_SetInteger( p_vout, "snapshot-width", i_width);
152 var_SetInteger( p_vout, "snapshot-height", i_height );
153 var_SetString( p_vout, "snapshot-path", psz_filepath );
154 var_SetString( p_vout, "snapshot-format", "png" );
155 var_TriggerCallback (p_vout, "video-snapshot" );
156 return 0;
157 }
I have an application which plays a video stream and saves a png image to file every 1 sec by calling libvlc_video_take_snapshot.
I have noticed that over time the amount of memory consumed by my app increases at a linear rate.
Looking at the source code forlibvlc_video_take_snapshot , a call to vlc_object_release (p_vout) is never made before we exit the method?
139 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
140 const char *psz_filepath,
141 unsigned int i_width, unsigned int i_height )
142 {
143 assert( psz_filepath );
144
145 vout_thread_t *p_vout = GetVout (p_mi, num);
146 if (p_vout == NULL)
147 return -1;
148
149 /* FIXME: This is not atomic. Someone else could change the values,
150 * at least in theory. */
151 var_SetInteger( p_vout, "snapshot-width", i_width);
152 var_SetInteger( p_vout, "snapshot-height", i_height );
153 var_SetString( p_vout, "snapshot-path", psz_filepath );
154 var_SetString( p_vout, "snapshot-format", "png" );
155 var_TriggerCallback (p_vout, "video-snapshot" );
156 return 0;
157 }