[EME] Use GMP for decoding EME encrypted streams in <video>

RESOLVED FIXED in mozilla34

Status

()

Core
Audio/Video
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: cpearce, Assigned: cpearce)

Tracking

(Blocks: 1 bug)

29 Branch
mozilla34
x86_64
Windows 8.1
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
The EME PDM needs MediaDataDecoders that use the GMP to decrypt and decode.
(Assignee)

Comment 1

4 years ago
Created attachment 8465962 [details] [diff] [review]
Patch v1

Add MediaDataDecoders that use the GMP for decrypting.

This patch is based on top of the patches in dependent bugs.
Attachment #8465962 - Flags: review?(edwin)
(Assignee)

Comment 2

4 years ago
Comment on attachment 8465962 [details] [diff] [review]
Patch v1

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

::: content/media/fmp4/eme/EMEAACDecoder.cpp
@@ +41,5 @@
> +}
> +
> +nsresult
> +EMEAACDecoder::Init() 
> +{

That's needs to be:

MOZ_ASSERT((mConfig.bits_per_sample / 8) == 2);

And yes, trailing whitespace. :P
Comment on attachment 8465962 [details] [diff] [review]
Patch v1

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

Just nits. Also trailing whitespace pretty much everywhere.

::: content/media/fmp4/eme/EMEAACDecoder.cpp
@@ +41,5 @@
> +}
> +
> +nsresult
> +EMEAACDecoder::Init() 
> +{

Sync call to GMP thread. Assert IsMainThread(), or at least !IsOnGMPThread().

@@ +103,5 @@
> +}
> +
> +nsresult
> +EMEAACDecoder::Shutdown()
> +{

Sync call to GMP thread. Assert IsMainThread(), or at least !IsOnGMPThread().

@@ +218,5 @@
> +  tags.AppendElement(NS_LITERAL_CSTRING("aac"));
> +  tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
> +  nsresult rv = mMPS->GetGMPAudioDecoder(&tags,
> +                                          mProxy->GetOrigin(), 
> +                                          &mGMP);

nit: alignment, here and below.

@@ +258,5 @@
> +      caps.CallWhenKeyUsable(aSample->crypto.key, task, mGMPThread);
> +      return NS_OK;
> +    }
> +  }
> +  nsAutoPtr<MP4Sample> autoDelete(aSample);

This should be at the top, and forget() called in the !IsKeyUsable case.

::: content/media/fmp4/eme/EMEAACDecoder.h
@@ +6,5 @@
> +
> +#ifndef EMEAACDecoder_h_
> +#define EMEAACDecoder_h_
> +
> + // people.mozilla.org/~cpearce/video/h264_baseline_lvl3.mp4

This can be removed.

@@ +39,5 @@
> +  virtual nsresult Shutdown() MOZ_OVERRIDE;
> +
> +  // GMPAudioDecoderProxyCallback implementation.
> +  virtual void Decoded(const nsTArray<int16_t>& aPCM,
> +                       uint64_t aTimeStamp);

MOZ_OVERRIDE

::: content/media/fmp4/eme/EMEH264Decoder.cpp
@@ +37,5 @@
> +}
> +
> +nsresult
> +EMEH264Decoder::Init()
> +{

Assert IsMainThread(), or at least !IsOnGMPThread().

@@ +97,5 @@
> +}
> +
> +nsresult
> +EMEH264Decoder::Shutdown()
> +{

Assert IsMainThread(), or at least !IsOnGMPThread().

@@ +268,5 @@
> +    }
> +  }
> +
> +  nsAutoPtr<MP4Sample> autoDelete(aSample);
> +  

This should be at the top, and forget() called in the !IsKeyUsable() case.

And whitespace below it.

::: content/media/fmp4/eme/EMEH264Decoder.h
@@ +38,5 @@
> +  virtual nsresult Drain() MOZ_OVERRIDE;
> +  virtual nsresult Shutdown() MOZ_OVERRIDE;
> +
> +  // GMPVideoDecoderProxyCallback
> +  virtual void Decoded(GMPVideoi420Frame* aDecodedFrame);

MOZ_OVERRIDE
Attachment #8465962 - Flags: review?(edwin) → review+
(Assignee)

Comment 4

4 years ago
(In reply to Edwin Flores [:eflores] [:edwin] from comment #3)
> ::: content/media/fmp4/eme/EMEAACDecoder.cpp
> @@ +41,5 @@
> > +}
> > +
> > +nsresult
> > +EMEAACDecoder::Init() 
> > +{
> 
> Sync call to GMP thread. Assert IsMainThread(), or at least !IsOnGMPThread().

All the MediaDataDecoder overrides run on the decode task queue, so there's no risk to doing sync dispatch to the GMP thread. I will add !IsOnGMPThread() assertions.

Comment 6

4 years ago
https://hg.mozilla.org/mozilla-central/rev/ad2a87a51d2c
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.