Bug 1324925 - Convert GMPTimestamp to epoch seconds in GMPDecryptorChild::ExpirationChange(). r?gerald draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 21 Dec 2016 11:52:16 +1300
changeset 451754 defe21e7e86b472390efd96de61146ea67c388a9
parent 450805 2824deb82146bba070995a762cfc98ddb2d1decb
child 451755 498196fe6c24b314d38dc21c7082e4c9a01ff321
child 451800 7148b586bd82cc042db9f76101c962d078cff8d6
push id39283
push usercpearce@mozilla.com
push dateTue, 20 Dec 2016 23:15:02 +0000
reviewersgerald
bugs1324925
milestone53.0a1
Bug 1324925 - Convert GMPTimestamp to epoch seconds in GMPDecryptorChild::ExpirationChange(). r?gerald MozReview-Commit-ID: 8tSl2kIQc1w
dom/media/eme/MediaKeySession.cpp
dom/media/gmp/GMPDecryptorChild.cpp
dom/media/gmp/GMPDecryptorParent.cpp
dom/media/gmp/PGMPDecryptor.ipdl
--- a/dom/media/eme/MediaKeySession.cpp
+++ b/dom/media/eme/MediaKeySession.cpp
@@ -632,23 +632,23 @@ MediaKeySession::MakePromise(ErrorResult
     NS_WARNING("Passed non-global to MediaKeys ctor!");
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
   return DetailedPromise::Create(global, aRv, aName);
 }
 
 void
-MediaKeySession::SetExpiration(double aExpiration)
+MediaKeySession::SetExpiration(double aSecondsSinceEpoch)
 {
   EME_LOG("MediaKeySession[%p,'%s'] SetExpiry(%lf)",
           this,
           NS_ConvertUTF16toUTF8(mSessionId).get(),
-          aExpiration);
-  mExpiration = aExpiration;
+          aSecondsSinceEpoch);
+  mExpiration = aSecondsSinceEpoch;
 }
 
 EventHandlerNonNull*
 MediaKeySession::GetOnkeystatuseschange()
 {
   return GetEventHandler(nsGkAtoms::onkeystatuseschange, EmptyString());
 }
 
--- a/dom/media/gmp/GMPDecryptorChild.cpp
+++ b/dom/media/gmp/GMPDecryptorChild.cpp
@@ -124,20 +124,21 @@ GMPDecryptorChild::SessionMessage(const 
   CALL_ON_GMP_THREAD(SendSessionMessage,
                      nsCString(aSessionId, aSessionIdLength),
                      aMessageType, Move(msg));
 }
 
 void
 GMPDecryptorChild::ExpirationChange(const char* aSessionId,
                                     uint32_t aSessionIdLength,
-                                    GMPTimestamp aExpiryTime)
+                                    GMPTimestamp aMillisecondsSinceEpoch)
 {
   CALL_ON_GMP_THREAD(SendExpirationChange,
-                     nsCString(aSessionId, aSessionIdLength), aExpiryTime);
+                     nsCString(aSessionId, aSessionIdLength),
+                     aMillisecondsSinceEpoch / 1e3);
 }
 
 void
 GMPDecryptorChild::SessionClosed(const char* aSessionId,
                                  uint32_t aSessionIdLength)
 {
   CALL_ON_GMP_THREAD(SendSessionClosed,
                      nsCString(aSessionId, aSessionIdLength));
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -302,26 +302,26 @@ GMPDecryptorParent::RecvSessionMessage(c
     return IPC_FAIL_NO_REASON(this);
   }
   mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
-                                         const double& aExpiryTime)
+                                         const double& aSecondsSinceEpoch)
 {
   LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
-        this, aSessionId.get(), aExpiryTime));
+        this, aSessionId.get(), aSecondsSinceEpoch));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
-  mCallback->ExpirationChange(aSessionId, aExpiryTime);
+  mCallback->ExpirationChange(aSessionId, aSecondsSinceEpoch);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
 {
   LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')",
         this, aSessionId.get()));
--- a/dom/media/gmp/PGMPDecryptor.ipdl
+++ b/dom/media/gmp/PGMPDecryptor.ipdl
@@ -66,17 +66,17 @@ parent:
   async RejectPromise(uint32_t aPromiseId,
                       GMPDOMException aDOMExceptionCode,
                       nsCString aMessage);
 
   async SessionMessage(nsCString aSessionId,
                        GMPSessionMessageType aMessageType,
                        uint8_t[] aMessage);
 
-  async ExpirationChange(nsCString aSessionId, double aExpiryTime);
+  async ExpirationChange(nsCString aSessionId, double aSecondsSinceEpoch);
 
   async SessionClosed(nsCString aSessionId);
 
   async SessionError(nsCString aSessionId,
                      GMPDOMException aDOMExceptionCode,
                      uint32_t aSystemCode,
                      nsCString aMessage);