-
Notifications
You must be signed in to change notification settings - Fork 0
Adjust to mpeg_ts v3 API #17
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
Conversation
| case Map.get(demuxing_engine.packets_map, track_id) do | ||
| [packet | rest] -> | ||
| demuxing_engine = put_in(demuxing_engine.packets_map[track_id], rest) | ||
| {[packet], demuxing_engine} | ||
|
|
||
| _other -> | ||
| {[], demuxing_engine} | ||
| 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.
| case Map.get(demuxing_engine.packets_map, track_id) do | |
| [packet | rest] -> | |
| demuxing_engine = put_in(demuxing_engine.packets_map[track_id], rest) | |
| {[packet], demuxing_engine} | |
| _other -> | |
| {[], demuxing_engine} | |
| end | |
| get_and_update_in(demuxing_engine.packets_map[track_id], fn | |
| [packet | rest] -> {[packet], rest} | |
| other -> {[], other} | |
| end |
I'd also move this function below pop_chunk
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.
I don't think we can use get_and_update_in here, as if we were to call take_packets/2 for a track_id which is not yet in packets_map, it would add an empty entry under this track_id key.
(it might happen when track_id is resolved based on PMT, but no PES packet with given track_id has yet arrived)
|
|
||
| packets_map = | ||
| Enum.reduce(new_packets, demuxing_engine.packets_map, fn new_packet, packets_map -> | ||
| Map.update(packets_map, new_packet.pid, [new_packet], &(&1 ++ [new_packet])) |
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.
Please use Qex
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.
good idea, done
| {maybe_tden_tag, demuxing_engine} = maybe_read_tden_tag(demuxing_engine, packet.payload.pts) | ||
| tden_tag = maybe_tden_tag || demuxing_engine.last_tden_tag |
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.
for me its unclear if maybe_read_tden_tag(demuxing_engine, packet.payload.pts)
- returns tden tag
- or sets it in
demuxing_engine.last_tden_tag - or both
because this function returns demuxing_engine as well as maybe_tden_tag. What about making it return only demuxing_engine?
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
| case Map.get(demuxing_engine.packets_map, track_id) do | ||
| [packet | rest] -> | ||
| demuxing_engine = put_in(demuxing_engine.packets_map[track_id], rest) | ||
| {[packet], demuxing_engine} | ||
|
|
||
| _other -> | ||
| {[], demuxing_engine} | ||
| 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.
if you want, you can use get_and_update_in - it will simplify this piece of code
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 change the behaviour, as described here: #17 (comment)
| with {:ok, packets} <- Map.fetch(demuxing_engine.packets_map, track_id), | ||
| {{:value, packet}, rest} <- Qex.pop(packets) do | ||
| demuxing_engine = put_in(demuxing_engine.packets_map[track_id], rest) | ||
| {[packet], demuxing_engine} | ||
| else | ||
| _other -> {[], demuxing_engine} |
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.
<3
FelonEkonom
left a comment
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.
🥇
closes membraneframework/membrane_core#1017
Related PR in
kim_mpeg_ts: kim-company/kim_mpeg_ts#12