forked from len0rd/rockbox
MPEGPlayer: Fix leakage of file decriptors if file wasn't accepted by playback engine-- code is now getting tested that couldn't be before. Also reset parser in stream init when it doesn't like the file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28853 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b985b4c54b
commit
6b1fcc67c2
2 changed files with 6 additions and 3 deletions
|
@ -1144,6 +1144,7 @@ int parser_init_stream(void)
|
||||||
if (!init_video_info())
|
if (!init_video_info())
|
||||||
{
|
{
|
||||||
/* Cannot determine video size, etc. */
|
/* Cannot determine video size, etc. */
|
||||||
|
parser_init_state();
|
||||||
return STREAM_UNSUPPORTED;
|
return STREAM_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,6 +1158,7 @@ int parser_init_stream(void)
|
||||||
if (video_str.start_pts == INVALID_TIMESTAMP)
|
if (video_str.start_pts == INVALID_TIMESTAMP)
|
||||||
{
|
{
|
||||||
/* Must have video at least */
|
/* Must have video at least */
|
||||||
|
parser_init_state();
|
||||||
return STREAM_UNSUPPORTED;
|
return STREAM_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -592,7 +592,7 @@ static int stream_on_close(void)
|
||||||
|
|
||||||
stream_mgr_lock();
|
stream_mgr_lock();
|
||||||
|
|
||||||
/* Any open file? */
|
/* Any open file that was accepted for playback? */
|
||||||
if (stream_mgr.filename != NULL)
|
if (stream_mgr.filename != NULL)
|
||||||
{
|
{
|
||||||
/* Yes - hide video */
|
/* Yes - hide video */
|
||||||
|
@ -602,12 +602,13 @@ static int stream_on_close(void)
|
||||||
stream_on_stop(false);
|
stream_on_stop(false);
|
||||||
/* Tell parser file is finished */
|
/* Tell parser file is finished */
|
||||||
parser_close_stream();
|
parser_close_stream();
|
||||||
/* Close file */
|
|
||||||
disk_buf_close();
|
|
||||||
/* Reinitialize manager */
|
/* Reinitialize manager */
|
||||||
stream_mgr_init_state();
|
stream_mgr_init_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Let disk buffer reset itself - file might be open even if no good */
|
||||||
|
disk_buf_close();
|
||||||
|
|
||||||
stream_mgr_unlock();
|
stream_mgr_unlock();
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue