Closed Bug 964197 Opened 10 years ago Closed 10 years ago

[MediaEncoder] Add video frame duration field in ISOMediaWriter

Categories

(Core :: Audio/Video: Recording, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: ayang, Assigned: ayang)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

Video frame rate is not fixed, muxer needs to keep each frame's duration for audio/video synchronization.
Attached patch keep_each_frame_duration (obsolete) — Splinter Review
Attachment #8365844 - Flags: review?(cpearce)
Summary: [MediaEncoder] Keep video frame duration when muxing video → [MediaEncoder] Add video frame duration field in ISOMediaWriter
Comment on attachment 8365844 [details] [diff] [review]
keep_each_frame_duration

Review of attachment 8365844 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good.

::: content/media/encoder/fmp4_muxer/ISOControl.h
@@ +100,5 @@
>    //   It only means the fragment number of current accumulated frames, not
>    //   the current 'creating' fragment mFragNum in ISOControl.
>    uint32_t mFragmentNumber;
>  
> +  // The last frame time tamp of last fragment. It is for cauculating the

s/time tamp/time stamp/
s/cauculating/calculating/
s/fragmenet/fragment/

::: content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp
@@ +159,5 @@
> +          frag->SetLastFragmentLastFrameTime(frames.ElementAt(i)->GetTimeStamp());
> +        }
> +      }
> +      sample_info_table[i].sample_duration =
> +        frame_time * mMeta.mVidMeta->VideoFrequency / 1000000;

Is the 1000000 here a specific value? Say number of microseconds per second? If so, please make this a #defined constant (or static const uint32_t/uint64_t), so that it's unlikely that people will accidentally miss adding a 0 when they use write the literal value.

For example, VideoUtils.h defines USECS_PER_S as the number of microseconds per second here:
http://dxr.mozilla.org/mozilla-central/source/content/media/VideoUtils.h#122

You could use that (if the 1000000 here represents the number of microseconds per second), or you could define your own that semantically makes sense here.
Attachment #8365844 - Flags: review?(cpearce) → review+
(In reply to Chris Pearce (:cpearce) from comment #2)
> For example, VideoUtils.h defines USECS_PER_S as the number of microseconds
> per second here:
> http://dxr.mozilla.org/mozilla-central/source/content/media/VideoUtils.h#122
> 
> You could use that (if the 1000000 here represents the number of
> microseconds per second), or you could define your own that semantically
> makes sense here.

 It represents microseconds per second here. I'll use USECS_PER_S in patch.
 Thanks for advice.
Carry r+.
Attachment #8365844 - Attachment is obsolete: true
Attachment #8369138 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d8a9d899c0d3
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
correcting target milestone, sorry for the bugmail spam
Target Milestone: mozilla30 → mozilla29
Component: Video/Audio → Video/Audio: Recording
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: