Closed Bug 961618 Opened 11 years ago Closed 11 years ago

[MediaEncoder] Reduce ISOMediaWriter memory usage

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)

The original design is to create a buffer (150k in this case) to write down the audio/video and ISO box info. It can be improved by swapping the audio/video data pointer to an array of uint8_t array. So the ISOMediaWriter only need to allocate small memory for ISO boxes.
Attached patch reduce_muxer_memory_usage (obsolete) (deleted) — Splinter Review
Assignee: nobody → ayang
Attachment #8362398 - Flags: review?(cpearce)
Comment on attachment 8362398 [details] [diff] [review] reduce_muxer_memory_usage Review of attachment 8362398 [details] [diff] [review]: ----------------------------------------------------------------- r=cpearce with the const violation fixed. ::: content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp @@ +87,5 @@ > NS_ENSURE_SUCCESS(rv, rv); > > uint32_t len = frames.Length(); > for (uint32_t i = 0; i < len; i++) { > + mControl->WriteAVData((nsTArray<uint8_t>&)frames.ElementAt(i)->GetFrameData()); You're casting a "const nsTArray" to a nsTArray here so you can change the contents. This is bad because some code may make assumptions based on GetFrameData() being const, and you break it here. I think you should rename EncodedFrame::SetFrameData() to SwapFrameData(), and call: nsTArray<uint8_t> frameData; frames.ElementAt(i)->SwapFrameData(&frameData); mControl->WriteAVData(frameData); That way you don't violate the "contract" of that const is supposed to enforce.
Attachment #8362398 - Flags: review?(cpearce) → review+
Put the renaming change reqeust of SetFrameData on Bug 959021 :)
Attached patch reduce_muxer_memory_usage (deleted) — Splinter Review
Using SwapOutFrameData(), carry r+. https://tbpl.mozilla.org/?tree=Try&rev=295643509c0f
Attachment #8362398 - Attachment is obsolete: true
Attachment #8368982 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 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: