Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement non_fast_start optimization in MP4 ISOM demuxer. #73

Merged
merged 21 commits into from
Aug 3, 2023

Conversation

varsill
Copy link
Contributor

@varsill varsill commented Jun 23, 2023

No description provided.

@varsill varsill marked this pull request as ready for review June 27, 2023 13:16
@varsill varsill requested a review from mat-hek as a code owner June 27, 2023 13:16
Comment on lines 143 to 161
def handle_demand(
Pad.ref(:output, _track_id),
_size,
:buffers,
_ctx,
state
) do
{[], state}
end

def handle_process(
:input,
_buffer,
_ctx,
%{
fsm_state: fsm_state
} = state
)
when fsm_state in [:mdat_skipping, :going_back_to_mdat] do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the formatting got quite bulky here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have improved it, done

{[], state}
def handle_event(
:input,
%Membrane.File.NewSeekEvent{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's alias it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

end

defp handle_non_fast_start_optimization(%{fsm_state: :go_back_to_mdat} = state) do
seek(state, state.mdat_beginning, state.mdat_size + @header_size, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
seek(state, state.mdat_beginning, state.mdat_size + @header_size, true)
seek(state, state.mdat_beginning, state.mdat_size + @header_size, false)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

lib/membrane_mp4/demuxer/isom.ex Show resolved Hide resolved
end
end

defp update_fsm_state(state) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed, add the context argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@varsill varsill requested a review from mat-hek July 19, 2023 08:43
Comment on lines +132 to +151
def handle_process(
:input,
_buffer,
_ctx,
%{
fsm_state: fsm_state
} = state
)
when fsm_state in [:mdat_skipping, :going_back_to_mdat] do
{[demand: :input], state}
end

@impl true
def handle_process(
:input,
buffer,
ctx,
%{all_pads_connected?: true, samples_info: %SamplesInfo{}} = state
%{
fsm_state: :samples_info_present_and_all_pads_connected
} = state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed

end
end

defp update_fsm_state(state, ctx \\ []) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context could be just an atom, a keyword list is overkill IMO. But do as you prefer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@varsill
Copy link
Contributor Author

varsill commented Jul 20, 2023

We need to wait until membraneframework/membrane_file_plugin#40 is merged and new version of membrane_file_plugin is released, so that we can change the deps in this PR

@varsill varsill merged commit 00666ee into master Aug 3, 2023
@varsill varsill deleted the non_fast_start_demuxer branch August 3, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants