Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Start stop loop only if some samples have been decoded..

  • Loading branch information...
commit 19582062a16ab61ef986c3a636770b1e4349780d 1 parent 31c99b5
@toots toots authored
Showing with 18 additions and 14 deletions.
  1. +18 −14 src/encoder/gstreamer_encoder.ml
View
32 src/encoder/gstreamer_encoder.ml
@@ -107,20 +107,24 @@ let encoder id ext =
in
let stop gst () =
- Utils.maydo Gstreamer.App_src.end_of_stream gst.audio_src;
- Utils.maydo Gstreamer.App_src.end_of_stream gst.video_src;
- let buf = Buffer.create 1024 in
- begin
- try
- while true do
- Buffer.add_string buf (Gstreamer.App_sink.pull_buffer_string gst.sink);
- decr_samples ()
- done
- with
- | Gstreamer.End_of_stream -> ()
- end;
- ignore (Gstreamer.Element.set_state gst.bin Gstreamer.Element.State_null);
- Buffer.contents buf
+ if !samples > 0 then
+ begin
+ Utils.maydo Gstreamer.App_src.end_of_stream gst.audio_src;
+ Utils.maydo Gstreamer.App_src.end_of_stream gst.video_src;
+ let buf = Buffer.create 1024 in
+ begin
+ try
+ while true do
+ Buffer.add_string buf (Gstreamer.App_sink.pull_buffer_string gst.sink)
+ done
+ with
+ | Gstreamer.End_of_stream -> ()
+ end;
+ ignore (Gstreamer.Element.set_state gst.bin Gstreamer.Element.State_null);
+ Buffer.contents buf
+ end
+ else
+ ""
in
let insert_metadata gst _ =
Please sign in to comment.
Something went wrong with that request. Please try again.