7 #ifndef PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
8 #define PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
14 #include <absl/log/log.h>
16 #include <packager/chunking_params.h>
17 #include <packager/media/base/media_handler.h>
49 Status
Process(std::unique_ptr<StreamData> stream_data)
override;
54 friend class ChunkingHandlerTest;
59 Status OnStreamInfo(std::shared_ptr<const StreamInfo> info);
60 Status OnCueEvent(std::shared_ptr<const CueEvent> event);
61 Status OnMediaSample(std::shared_ptr<const MediaSample> sample);
63 Status EndSegmentIfStarted();
64 Status EndSubsegmentIfStarted()
const;
66 bool IsSubsegmentEnabled() {
67 return subsegment_duration_ > 0 &&
68 subsegment_duration_ != segment_duration_;
71 const ChunkingParams chunking_params_;
74 int64_t segment_duration_ = 0;
75 int64_t subsegment_duration_ = 0;
79 int64_t segment_number_ = 1;
82 int64_t current_segment_index_ = -1;
85 int64_t current_subsegment_index_ = -1;
87 std::optional<int64_t> segment_start_time_;
88 std::optional<int64_t> subsegment_start_time_;
89 int64_t max_segment_time_ = 0;
90 int32_t time_scale_ = 0;
94 int64_t cue_offset_ = 0;
All the methods that are virtual are virtual for mocking.