-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix chunk offsets #110
Fix chunk offsets #110
Conversation
…value per each sample. Consume the mdat iterator while reading data from mdat
…of mdat data. Calculate start of mdat based on this function.
# data = | ||
# case data do | ||
# <<0, 0, 0, 0, 0, 0, 0, 0, rest::binary>> -> rest | ||
# _other -> data | ||
# end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it left just in case? :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed ;)
sample = | ||
Map.put(sample, :track_id, track_id) |> Map.put(:chunk_offset, chunk_offset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could accumulate the offset of each chunk here
There was a problem hiding this comment.
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
Outdated
@@ -141,12 +142,15 @@ defmodule Membrane.MP4.Demuxer.ISOM do | |||
fsm_state: :samples_info_present_and_all_pads_connected | |||
} = state | |||
) do | |||
{samples, rest, samples_info} = | |||
SamplesInfo.get_samples(state.samples_info, state.partial <> buffer.payload) | |||
{samples, {rest, rest_iterator}, samples_info} = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest_iterator
could be initialized in SamplesInfo.get_samples_info
and kept in samples_info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…mposition_offset. Add tests.
…nt to the beggining of mdat's header.
lib/membrane_mp4/demuxer/isom.ex
Outdated
{state.mdat_beginning || get_mdat_header_beginning(state.boxes), | ||
state.mdat_header_size || maybe_header[:header_size] || state.boxes[:mdat].header_size, | ||
state.mdat_size || maybe_header[:content_size] || state.boxes[:mdat].size} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's update the state here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if to_skip + size <= byte_size(data) do | ||
<<_to_skip::binary-size(to_skip), payload::binary-size(size), rest::binary>> = data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would look better as a case
if to_skip + size <= byte_size(data) do | |
<<_to_skip::binary-size(to_skip), payload::binary-size(size), rest::binary>> = data | |
case data do | |
<<_to_skip::binary-size(to_skip), payload::binary-size(size), rest::binary>> -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
[ | ||
buffer | buffers | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ | |
buffer | buffers | |
] | |
[buffer | buffers] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Map.put(sample, :track_id, track_id) | ||
|> Map.put(:chunk_offset, chunk_offset) | ||
|> Map.put(:sample_offset, sample_offset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use Map.merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* Add support for version1 boxes. Add parsing of co64 box * Fix chunk offsets (#110) * bump to v0.34.2
No description provided.