kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
1.99k stars 439 forks source link

question about use initial_pts_delay #966

Open FenceWang opened 5 years ago

FenceWang commented 5 years ago

In function mp4_fragment_write_video_trun_atom, there is a if sentence like this: if (version == 1) { initial_pts_delay = cur_clip->first_track->media_info.u.video.initial_pts_delay; }

I don't understand what reason why it is. This maybe corrupt pts content in the result m4s.

According to the setting in the dash_packager_get_track_spec, version is set to 3. switch (media_type) { case MEDIA_TYPE_VIDEO: p = vod_sprintf(p, "v%uD", track_index + 1); p = vod_copy(p, "-x3", sizeof("-x3") - 1); // TODO: remove this after deployment break;

case MEDIA_TYPE_AUDIO:
    p = vod_sprintf(p, "a%uD", track_index + 1);
    p = vod_copy(p, "-x3", sizeof("-x3") - 1);      // TODO: remove this after deployment
    break;
}

Can you give me a explain? Waiting for reply!

erankor commented 5 years ago

The purpose of the version is to enable the deployment of breaking changes without any interruption. In this case, when we moved from 2 to 3 we changed the PTS delay to be signed - each keyframe now has a PTS delay of 0. Playing a mix of v2 and v3 segments will cause an error, and this is what the version solves - a user who got a manifest with v2 will continue playing v2, even after the code supporting v3 was deployed. Anyway, since this is a very old change, it can be omitted (as the comment says) and the code can assume it's always v3.