From a1314a40fef198bcb4c237966647dfe960073608 Mon Sep 17 00:00:00 2001 From: "lee.fordyce" Date: Tue, 5 Dec 2023 11:13:38 -0700 Subject: [PATCH] fix: PR feedback --- packager/live_packager.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packager/live_packager.cc b/packager/live_packager.cc index e658579be97..42a5e24c2cd 100644 --- a/packager/live_packager.cc +++ b/packager/live_packager.cc @@ -172,27 +172,23 @@ struct LivePackager::LivePackagerInternal { std::unique_ptr segment_manager; }; -LivePackager::LivePackager(const LiveConfig& config) : config_(config) { +LivePackager::LivePackager(const LiveConfig& config) + : internal_(new LivePackagerInternal), config_(config) { absl::SetMinLogLevel(absl::LogSeverityAtLeast::kWarning); - std::unique_ptr internal(new LivePackagerInternal); if (config.protection_scheme == LiveConfig::EncryptionScheme::AES_128 && config.format == LiveConfig::OutputFormat::TS) { - internal->segment_manager = + internal_->segment_manager = std::make_unique(config.key, config.iv); } else { - internal->segment_manager = std::make_unique(); + internal_->segment_manager = std::make_unique(); } - internal_ = std::move(internal); } -LivePackager::~LivePackager() {} +LivePackager::~LivePackager() = default; Status LivePackager::PackageInit(const Segment& init_segment, FullSegmentBuffer& output) { - if (!internal_) - return Status(error::INVALID_ARGUMENT, "Failed to initialize"); - SegmentDataReader reader(init_segment); shaka::BufferCallbackParams callback_params; @@ -241,9 +237,6 @@ Status LivePackager::PackageInit(const Segment& init_segment, } Status LivePackager::Package(const Segment& in, FullSegmentBuffer& out) { - if (!internal_) - return Status(error::INVALID_ARGUMENT, "Failed to initialize"); - SegmentDataReader reader(in); shaka::BufferCallbackParams callback_params; callback_params.read_func = [&reader](const std::string& name, void* buffer, @@ -303,6 +296,7 @@ uint64_t SegmentManager::OnSegmentWrite(const std::string& name, void SegmentManager::InitializeEncryption(const LiveConfig& config, EncryptionParams& encryption_params) { + // TODO: encryption for fmp4 will be added later if (config.protection_scheme == LiveConfig::EncryptionScheme::SAMPLE_AES) { // Internally shaka maps this to an internal code for sample aes //