From 2c51dcc601d2d3bea50899b47ee95527c01beb61 Mon Sep 17 00:00:00 2001 From: Tomohiro IKEDA Date: Tue, 16 Jul 2019 03:03:42 +0900 Subject: [PATCH] Code cleanup: no "if return else return" (#611) - Unify code format - Low nest level --- packager/hls/base/simple_hls_notifier.cc | 12 +++++++----- packager/packager.cc | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packager/hls/base/simple_hls_notifier.cc b/packager/hls/base/simple_hls_notifier.cc index bf9926f2a1..ba21f61744 100644 --- a/packager/hls/base/simple_hls_notifier.cc +++ b/packager/hls/base/simple_hls_notifier.cc @@ -184,14 +184,15 @@ base::Optional StringToEncryptionMethod( const std::string& method) { if (method == "cenc") { return MediaPlaylist::EncryptionMethod::kSampleAesCenc; - } else if (method == "cbcs") { + } + if (method == "cbcs") { return MediaPlaylist::EncryptionMethod::kSampleAes; - } else if (method == "cbca") { + } + if (method == "cbca") { // cbca is a place holder for sample aes. return MediaPlaylist::EncryptionMethod::kSampleAes; - } else { - return base::nullopt; } + return base::nullopt; } void NotifyEncryptionToMediaPlaylist( @@ -459,7 +460,8 @@ bool SimpleHlsNotifier::NotifyEncryptionUpdate( NotifyEncryptionToMediaPlaylist(encryption_method, key_uri, empty_key_id, iv, "identity", "", media_playlist.get()); return true; - } else if (IsFairPlaySystemId(system_id)) { + } + if (IsFairPlaySystemId(system_id)) { std::string key_uri = hls_params().key_uri; if (key_uri.empty()) { // Use key_id as the key_uri. The player needs to have custom logic to diff --git a/packager/packager.cc b/packager/packager.cc index e8fb0b010e..40d76147db 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -210,7 +210,8 @@ Status ValidateStreamDescriptor(bool dump_stream_info, if (output_format == CONTAINER_UNKNOWN) { return Status(error::INVALID_ARGUMENT, "Unsupported output format."); - } else if (output_format == MediaContainerName::CONTAINER_MPEG2TS) { + } + if (output_format == MediaContainerName::CONTAINER_MPEG2TS) { if (stream.segment_template.empty()) { return Status( error::INVALID_ARGUMENT, @@ -355,9 +356,8 @@ bool StreamDescriptorCompareFn(const StreamDescriptor& a, // The MPD notifier requires that the main track comes first, so make // sure that happens. return a.trick_play_factor < b.trick_play_factor; - } else { - return a.stream_selector < b.stream_selector; } + return a.stream_selector < b.stream_selector; } return a.input < b.input;