-
Notifications
You must be signed in to change notification settings - Fork 1
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
Timestamps for B frames #38
Conversation
af27eeb
to
58e881b
Compare
lib/membrane_h264_plugin/parser.ex
Outdated
@@ -319,40 +327,62 @@ defmodule Membrane.H264.Parser do | |||
output_alignment: state.output_alignment | |||
) | |||
|
|||
{[stream_format: {:output, fmt}], fmt.profile} | |||
max_frame_reorder = if fmt.profile in [:baseline, :constrained_baseline], do: 0, else: 15 |
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.
As discussed, that can cause some problems when the profile is changed during the stream run
3cf513c
to
58e881b
Compare
Co-authored-by: Łukasz Kita <lukasz.kita0@gmail.com>
lib/membrane_h264_plugin/parser.ex
Outdated
description: """ | ||
Generates timestamps based on given `framerate`. | ||
|
||
This option works only when `Membrane.RemoteStream` format arrives on |
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 can add some warning when other format arrives and generate_best_effort_timestamps: true
is set, that the option has no effect
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, but then we would warn if somebody had the same parser config for different inputs
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.
Just one small thing to consider ;)
%{au_counter: au_counter, key_frame_au_idx: key_frame_au_idx} = state | ||
first_vcl_nalu = Enum.find(au, &NALuTypes.is_vcl_nalu_type(&1.type)) | ||
{poc, state} = calculate_poc(first_vcl_nalu, state) | ||
key_frame_au_idx = if poc == 0, do: au_counter, else: key_frame_au_idx | ||
pts = div((key_frame_au_idx + poc) * seconds * Membrane.Time.second(), frames) | ||
max_frame_reorder = if Map.get(config, :add_dts_offset, true), do: 15, else: 0 |
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 parametrize that magic number 15
. I would also consider "parsing" that add_dts_offset
option in handle_init
(by which I mean that we can set its default value there)
7370eec
to
a91eaf1
Compare
a91eaf1
to
3ff0b46
Compare
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.
LGTM 🥇
TODO:
max_frame_reorder
option