From 7f510be3bcec5b8678a70c9ac2cb559c40fa00db Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 12 Jan 2015 16:48:38 -0800 Subject: [PATCH] Call MuxerListener::OnNewSegment in SingleSegmentSegmenter as well Needed for progress reporting. Change-Id: I936a9f4bad99bfa38fdf995fcc8c2f44d990fa00 --- packager/media/formats/mp4/single_segment_segmenter.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packager/media/formats/mp4/single_segment_segmenter.cc b/packager/media/formats/mp4/single_segment_segmenter.cc index 6171d2a120..107759f4ef 100644 --- a/packager/media/formats/mp4/single_segment_segmenter.cc +++ b/packager/media/formats/mp4/single_segment_segmenter.cc @@ -10,6 +10,7 @@ #include "packager/media/base/buffer_writer.h" #include "packager/media/base/media_stream.h" #include "packager/media/base/muxer_options.h" +#include "packager/media/event/muxer_listener.h" #include "packager/media/file/file.h" #include "packager/media/formats/mp4/box_definitions.h" @@ -168,7 +169,14 @@ Status SingleSegmentSegmenter::DoFinalizeSegment() { vod_sidx_->references.push_back(vod_ref); // Append fragment buffer to temp file. - return fragment_buffer()->WriteToFile(temp_file_.get()); + size_t segment_size = fragment_buffer()->Size(); + Status status = fragment_buffer()->WriteToFile(temp_file_.get()); + if (!status.ok()) return status; + if (muxer_listener()) { + muxer_listener()->OnNewSegment(vod_ref.earliest_presentation_time, + vod_ref.subsegment_duration, segment_size); + } + return Status::OK; } } // namespace mp4