Closed Bug 1378689 Opened 2 years ago Closed 2 years ago

Add a structure to pack the data sent to the MediaDecoderReader constructor

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(1 file)

It would be handy when we want to send more data to the constructor.
Assignee: nobody → jwwang
Blocks: 1378295
Priority: -- → P3
Attachment #8884183 - Flags: review?(jyavenard)
Comment on attachment 8884183 [details]
Bug 1378689 - add a structure to pack the data sent to the MediaDecoderReader constructor.

https://reviewboard.mozilla.org/r/155110/#review160172

::: dom/media/DecoderTraits.h:55
(Diff revision 1)
>      DecoderDoctorDiagnostics* aDiagnostics);
>  
>    // Create a reader for thew given MIME type aType. Returns null
>    // if we were unable to create the reader.
>    static MediaDecoderReader* CreateReader(const MediaContainerType& aType,
> -                                          AbstractMediaDecoder* aDecoder,
> +                                          MediaDecoderReaderInit& aInit);

MediaDecoderReaderInit only contains pointer and is never modified (nor do I see the need for it now or in the future)

so please make all of those constructors use const MediaDecoderReaderInit& instead.

::: dom/media/DecoderTraits.cpp:355
(Diff revision 1)
>    }
>  
>  #ifdef MOZ_FMP4
>    if (MP4Decoder::IsSupportedType(aType,
>                                    /* DecoderDoctorDiagnostics* */ nullptr)) {
> -    decoderReader = new MediaFormatReader(aDecoder, new MP4Demuxer(aResource));
> +    decoderReader = new MediaFormatReader(aInit, new MP4Demuxer(resource));

I'd prefer to drop the temp variable and use aInit.mResource everywhere

::: dom/media/MediaDecoderReader.h:71
(Diff revision 1)
> +{
> +  AbstractMediaDecoder* const mDecoder;
> +  MediaResource* mResource = nullptr;
> +  VideoFrameContainer* mVideoFrameContainer = nullptr;
> +
> +  explicit MediaDecoderReaderInit(AbstractMediaDecoder* aDecoder)

didn't you remove AbstractMediaDecoder* ?
Attachment #8884183 - Flags: review?(jyavenard) → review+
Comment on attachment 8884183 [details]
Bug 1378689 - add a structure to pack the data sent to the MediaDecoderReader constructor.

https://reviewboard.mozilla.org/r/155110/#review160172

> I'd prefer to drop the temp variable and use aInit.mResource everywhere

It will make line-breaking ugly for it slightly exceed the 80-cols limit.

> didn't you remove AbstractMediaDecoder* ?

We will. But for now we still have AndroidMediaReader which accesses AbstractMediaDecoder.
Comment on attachment 8884183 [details]
Bug 1378689 - add a structure to pack the data sent to the MediaDecoderReader constructor.

https://reviewboard.mozilla.org/r/155110/#review160182

::: dom/media/DecoderTraits.cpp:355
(Diff revision 1)
>    }
>  
>  #ifdef MOZ_FMP4
>    if (MP4Decoder::IsSupportedType(aType,
>                                    /* DecoderDoctorDiagnostics* */ nullptr)) {
> -    decoderReader = new MediaFormatReader(aDecoder, new MP4Demuxer(aResource));
> +    decoderReader = new MediaFormatReader(aInit, new MP4Demuxer(resource));

at least only declare it below the test then, otherwise it's unused.
Comment on attachment 8884183 [details]
Bug 1378689 - add a structure to pack the data sent to the MediaDecoderReader constructor.

https://reviewboard.mozilla.org/r/155110/#review160182

> at least only declare it below the test then, otherwise it's unused.

The |if (!aInit.mDecoder)| test?
Comment on attachment 8884183 [details]
Bug 1378689 - add a structure to pack the data sent to the MediaDecoderReader constructor.

https://reviewboard.mozilla.org/r/155110/#review160182

> The |if (!aInit.mDecoder)| test?

yes
Thanks for the review.
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dfe994f2c670
add a structure to pack the data sent to the MediaDecoderReader constructor. r=jya
https://hg.mozilla.org/mozilla-central/rev/dfe994f2c670
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.