Skip to content

Commit

Permalink
Temporarily revert "Multi period for DASH (#78)"
Browse files Browse the repository at this point in the history
This (manually) reverts the non-refactoring parts of commit
e6152fd.

For the v0.4.0 release, we will remove the multi-period DASH feature.
It will then be restored and released together with multi-period HLS
in v0.5.0.

Change-Id: I450ca7b78d93f781d85a9561a6b747e4389d0126
  • Loading branch information
joeyparrish committed Aug 26, 2021
1 parent 2a4d307 commit ea9f1f2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 390 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
- Restrict WebM formats to DASH, omit from HLS
(https://github.com/google/shaka-streamer/issues/18)
(https://github.com/google/shaka-streamer/pull/80)
- Multi period support for DASH
(https://github.com/google/shaka-streamer/issues/43)
(https://github.com/google/shaka-streamer/pull/78)
- Automatic frame rate reduction
(https://github.com/google/shaka-streamer/pull/77)
- Fix missing members in docs, auto-link to types in config docs
Expand Down
104 changes: 0 additions & 104 deletions config_files/input_multiperiod.yaml

This file was deleted.

35 changes: 4 additions & 31 deletions streamer/controller_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from streamer.packager_node import PackagerNode
from streamer.pipeline_configuration import PipelineConfig, StreamingMode
from streamer.transcoder_node import TranscoderNode
from streamer.periodconcat_node import PeriodConcatNode
import streamer.subprocessWindowsPatch # side-effects only
from streamer.util import is_url
from streamer.pipe import Pipe
Expand Down Expand Up @@ -137,32 +136,13 @@ def start(self, output_location: str,
if bucket_url:
raise RuntimeError(
'Cloud bucket upload is incompatible with HTTP PUT support.')

if self._input_config.multiperiod_inputs_list:
# TODO: Edit Multiperiod input list implementation to support HTTP outputs
raise RuntimeError(
'Multiperiod input list support is incompatible with HTTP outputs.')

# Note that we remove the trailing slash from the output location, because
# otherwise GCS would create a subdirectory whose name is "".
output_location = output_location.rstrip('/')

if self._input_config.inputs:
# InputConfig contains inputs only.
self._append_nodes_for_inputs_list(self._input_config.inputs, output_location)
else:
# InputConfig contains multiperiod_inputs_list only.
# Create one Transcoder node and one Packager node for each period.
for i, singleperiod in enumerate(self._input_config.multiperiod_inputs_list):
sub_dir_name = 'period_' + str(i)
self._append_nodes_for_inputs_list(singleperiod.inputs, output_location, sub_dir_name)

if self._pipeline_config.streaming_mode == StreamingMode.VOD:
packager_nodes = [node for node in self._nodes if isinstance(node, PackagerNode)]
self._nodes.append(PeriodConcatNode(
self._pipeline_config,
packager_nodes,
output_location))
# InputConfig contains inputs only.
self._append_nodes_for_inputs_list(self._input_config.inputs, output_location)

if bucket_url:
cloud_temp_dir = os.path.join(self._temp_dir, 'cloud')
Expand All @@ -180,13 +160,12 @@ def start(self, output_location: str,

return self

def _append_nodes_for_inputs_list(self, inputs: List[Input], output_location: str,
period_dir: Optional[str] = None) -> None:
def _append_nodes_for_inputs_list(self, inputs: List[Input],
output_location: str) -> None:
"""A common method that creates Transcoder and Packager nodes for a list of Inputs passed to it.
Args:
inputs (List[Input]): A list of Input streams.
period_dir (Optional[str]): A subdirectory name where a single period will be outputted to.
If passed, this indicates that inputs argument is one period in a list of periods.
"""

Expand Down Expand Up @@ -251,12 +230,6 @@ def _append_nodes_for_inputs_list(self, inputs: List[Input], output_location: st
self._pipeline_config,
outputs))

# If the inputs list was a period in multiperiod_inputs_list, create a nested directory
# and put that period in it.
if period_dir:
output_location = os.path.join(output_location, period_dir)
os.mkdir(output_location)

self._nodes.append(PackagerNode(self._pipeline_config,
output_location,
outputs))
Expand Down
36 changes: 1 addition & 35 deletions streamer/input_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,42 +313,8 @@ def get_resolution(self) -> bitrate_configuration.VideoResolution:
def get_channel_layout(self) -> bitrate_configuration.AudioChannelLayout:
return bitrate_configuration.AudioChannelLayout.get_value(self.channel_layout)

class SinglePeriod(configuration.Base):
"""An object repersenting one optional video stream and multiple audio and text streams"""

inputs = configuration.Field(List[Input], required=True).cast()

class InputConfig(configuration.Base):
"""An object representing the entire input config to Shaka Streamer."""

multiperiod_inputs_list = configuration.Field(List[SinglePeriod]).cast()
"""A list of SinglePeriod objects"""

inputs = configuration.Field(List[Input]).cast()
inputs = configuration.Field(List[Input], required=True).cast()
"""A list of Input objects"""

def __init__(self, dictionary: Dict[str, Any]):
"""A constructor to check that either inputs or mutliperiod_inputs_list is provided,
and produce a helpful error message in case both or none are provided.
We need these checks before passing the input dictionary to the configuration.Base constructor,
because it does not check for this 'exclusive or-ing' relationship between fields.
"""

assert isinstance(dictionary, dict), """Malformed Input Config File,
See some examples at https://github.com/google/shaka-streamer/tree/master/config_files.
"""

if (dictionary.get('inputs') is not None
and dictionary.get('multiperiod_inputs_list') is not None):
raise configuration.ConflictingFields(
InputConfig, 'inputs', 'multiperiod_inputs_list')

# Because these fields are not marked as required at the class level
# , we need to check ourselves that one of them is provided.
if not dictionary.get('inputs') and not dictionary.get('multiperiod_inputs_list'):
raise configuration.MissingRequiredExclusiveFields(
InputConfig, 'inputs', 'multiperiod_inputs_list')

super().__init__(dictionary)

138 changes: 0 additions & 138 deletions streamer/periodconcat_node.py

This file was deleted.

Loading

0 comments on commit ea9f1f2

Please sign in to comment.