7 #ifndef PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_ 8 #define PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_ 13 #include "packager/base/logging.h" 14 #include "packager/media/base/media_handler.h" 15 #include "packager/media/public/chunking_params.h" 55 Status Process(std::unique_ptr<StreamData> stream_data)
override;
60 friend class ChunkingHandlerTest;
72 Status DispatchSegmentInfoForAllStreams();
73 Status DispatchSubsegmentInfoForAllStreams();
74 Status DispatchCueEventForAllStreams(std::shared_ptr<CueEvent> cue_event);
79 std::atomic<int64_t> thread_id_;
83 const size_t kInvalidStreamIndex =
static_cast<size_t>(-1);
84 size_t main_stream_index_ = kInvalidStreamIndex;
86 int64_t segment_duration_ = 0;
87 int64_t subsegment_duration_ = 0;
89 class MediaSampleTimestampGreater {
91 explicit MediaSampleTimestampGreater(
96 bool operator()(
const std::unique_ptr<StreamData>& lhs,
97 const std::unique_ptr<StreamData>& rhs)
const;
100 double GetSampleTimeInSeconds(
101 const StreamData& media_sample_stream_data)
const;
105 MediaSampleTimestampGreater media_sample_comparator_;
107 std::priority_queue<std::unique_ptr<StreamData>,
108 std::vector<std::unique_ptr<StreamData>>,
109 MediaSampleTimestampGreater>
110 cached_media_sample_stream_data_;
112 std::vector<size_t> num_cached_samples_;
115 int64_t current_segment_index_ = -1;
117 int64_t current_subsegment_index_ = -1;
119 std::vector<std::shared_ptr<SegmentInfo>> segment_info_;
120 std::vector<std::shared_ptr<SegmentInfo>> subsegment_info_;
121 std::vector<uint32_t> time_scales_;
123 std::vector<int64_t> last_sample_end_timestamps_;
125 struct Scte35EventTimestampGreater {
126 bool operator()(
const std::unique_ptr<StreamData>& lhs,
127 const std::unique_ptr<StreamData>& rhs)
const;
132 std::priority_queue<std::unique_ptr<StreamData>,
133 std::vector<std::unique_ptr<StreamData>>,
134 Scte35EventTimestampGreater>
141 #endif // PACKAGER_MEDIA_CHUNKING_CHUNKING_HANDLER_
All the methods that are virtual are virtual for mocking.
Chunking (segmentation) related parameters.