Permalink
Browse files

One could claim that having the ffmpeg file handle open while just st…

…reaming is wasteful. I agree.
  • Loading branch information...
1 parent 4294cea commit b16c79f442811b67cde523163681cc861e69edf0 @skinkie skinkie committed Jan 18, 2013
Showing with 9 additions and 6 deletions.
  1. +9 −6 cherokee/handler_streaming.c
@@ -110,11 +110,6 @@ cherokee_handler_streaming_free (cherokee_handler_streaming_t *hdl)
cherokee_handler_free ((void *) hdl->handler_file);
}
- if (hdl->avformat != NULL) {
- TRACE(ENTRIES, "close_file (free) %s\n", hdl->local_file.buf);
- av_close_input_file (hdl->avformat);
- }
-
cherokee_buffer_mrproper (&hdl->local_file);
return ret_ok;
}
@@ -474,7 +469,7 @@ cherokee_handler_streaming_init (cherokee_handler_streaming_t *hdl)
ret = seek_mp3 (hdl);
if (unlikely (ret != ret_ok)) {
- return ret_error;
+ goto out;
}
}
@@ -484,6 +479,14 @@ cherokee_handler_streaming_init (cherokee_handler_streaming_t *hdl)
set_auto_rate (hdl);
}
+out:
+ /* Close our ffmpeg handle, all information has been gathered
+ */
+ if (hdl->avformat != NULL) {
+ TRACE(ENTRIES, "close_file %s\n", hdl->local_file.buf);
+ av_close_input_file (hdl->avformat);
+ }
+
return ret_ok;
}

0 comments on commit b16c79f

Please sign in to comment.