Code cleanup: no "if return else return" (#611)

- Unify code format
- Low nest level
This commit is contained in:
Tomohiro IKEDA 2019-07-16 03:03:42 +09:00 committed by Kongqun Yang
parent 3c26dfbd53
commit 2c51dcc601
2 changed files with 10 additions and 8 deletions

View File

@ -184,14 +184,15 @@ base::Optional<MediaPlaylist::EncryptionMethod> 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

View File

@ -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;