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

Sink should merge temporary file and close the main one on end of stream event #37

Closed
gBillal opened this issue May 12, 2023 · 3 comments · Fixed by #38
Closed

Sink should merge temporary file and close the main one on end of stream event #37

gBillal opened this issue May 12, 2023 · 3 comments · Fixed by #38
Assignees

Comments

@gBillal
Copy link
Contributor

gBillal commented May 12, 2023

Currently the Membrane.File.Sink only merge temporary file with the main file and close it when it receives a terminate event. Shouldn't it do the same when it receives an end_of_stream since the pad will not be used anymore.

@impl true
def handle_end_of_stream(:input, _ctx, state) do
  state = maybe_merge_temporary(state)
  @common_file.close!(state.fd)

  {[], %{state | fd: nil}}
end

In my case, I save a mp4 file with fast start to a temporary file and send it to a remote store. I send the temporary file after receiving element_end_of_stream event in the main pipeline and then terminate the children. At this point the MP4 file is not yet merged and closed. Of course there's a workaround like sending a message to the pipeline, terminate the children and then processing the sent message. However I think it's more appropriate to do it in the sink.

@DominikWolek
Copy link
Contributor

I guess, yeah, you're right. Can you open a Pull request? Or would you like somebody of the team take care of it?

@DominikWolek DominikWolek self-assigned this May 18, 2023
@gBillal
Copy link
Contributor Author

gBillal commented May 18, 2023

@DominikWolek no problem, I'll create a PR for this issue

@DominikWolek
Copy link
Contributor

Great!

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 a pull request may close this issue.

2 participants