Bug 1375708 - Use base::Time() instead of time(0) in WidevineDecryptor::GetCurrentWallTime(). r=gerald

On Linux some implementations of time(0) appear to be suffering from integer
overflow and giving us the wrong dates. This causes the time we expose to the
CDM to be wrong, and so licenses passed to the CDM are failing to authenticate,
and Netflix is thus broken on some Linux systems.

This is only happening in Firefox 54 and earlier, as in those versions we use
the WidevineDecryptor to talk to the CDM. In 55 (in beta) and later we use the
PChromiumCDM protocol to talk to the CDM. This doesn't use time(0) to get a
time for the CDM, so it's immune to the problem here.

So this patch makes the GetCurrentWallTime() implementation in
WidevineDecryptor match the code currently being used on Nightly and Beta in
the ChromiumCDMChild::GetCurrentWallTime() function.

Since we use the PChromiumCDM protocol to talk to the CDM on Nightly and Beta
by default, the WidevineDecryptor isn't actually being used on Nightly and
Beta. So this patch will only cause a behaviour change in Release, which still
uses the old backend. However it will make Release run the same code that we're
running in Nightly and Beta, so it should be safe to uplift to Release.

MozReview-Commit-ID: J58iDyinyQG

--HG--
extra : rebase_source : dcdf4a846f7b007526aa626db24598942f13f01d
This commit is contained in:
Chris Pearce 2017-06-23 16:02:14 +12:00
parent 64a0e9a63e
commit 5734680cc7
2 changed files with 4 additions and 5 deletions

View File

@ -9,6 +9,7 @@
#include "WidevineUtils.h"
#include "WidevineFileIO.h"
#include <stdarg.h>
#include "base/time.h"
using namespace cdm;
using namespace std;
@ -238,11 +239,7 @@ WidevineDecryptor::SetTimer(int64_t aDelayMs, void* aContext)
Time
WidevineDecryptor::GetCurrentWallTime()
{
GMPTimestamp gmpTime = 0;
GMPGetCurrentTime(&gmpTime);
double t = (double)gmpTime / 1e3;
CDM_LOG("Decryptor::GetCurrentWallTime()= %lf", t);
return t;
return base::Time::Now().ToDoubleT();
}
void

View File

@ -29,3 +29,5 @@ LOCAL_INCLUDES += [
if CONFIG['CLANG_CXX']:
CXXFLAGS += ['-Wno-error=shadow']
include('/ipc/chromium/chromium-config.mozbuild')