Update code to resolve problems due to base updates.
Notably deprecate of OVERRIDE, to be replaced with C++11 override. Bug: 22463130 Bug: 22664127 Change-Id: I12c82e092e9e8eb0870da4363307c3563a3531b7
This commit is contained in:
parent
8cd33d8b21
commit
47c79d08ce
|
@ -78,7 +78,7 @@ namespace media {
|
||||||
// testing.
|
// testing.
|
||||||
class FakeClock : public base::Clock {
|
class FakeClock : public base::Clock {
|
||||||
public:
|
public:
|
||||||
virtual base::Time Now() OVERRIDE { return base::Time(); }
|
base::Time Now() override { return base::Time(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Demux, Mux(es) and worker thread used to remux a source file/stream.
|
// Demux, Mux(es) and worker thread used to remux a source file/stream.
|
||||||
|
@ -88,7 +88,7 @@ class RemuxJob : public base::SimpleThread {
|
||||||
: SimpleThread("RemuxJob"),
|
: SimpleThread("RemuxJob"),
|
||||||
demuxer_(demuxer.Pass()) {}
|
demuxer_(demuxer.Pass()) {}
|
||||||
|
|
||||||
virtual ~RemuxJob() {
|
~RemuxJob() override {
|
||||||
STLDeleteElements(&muxers_);
|
STLDeleteElements(&muxers_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class RemuxJob : public base::SimpleThread {
|
||||||
Status status() { return status_; }
|
Status status() { return status_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void Run() OVERRIDE {
|
void Run() override {
|
||||||
DCHECK(demuxer_);
|
DCHECK(demuxer_);
|
||||||
status_ = demuxer_->Run();
|
status_ = demuxer_->Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@ bool ValidateWidevineCryptoFlags() {
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if (widevine_crypto && FLAGS_signer.empty() &&
|
if (widevine_crypto && FLAGS_signer.empty() &&
|
||||||
StartsWithASCII(FLAGS_key_server_url, "http", false)) {
|
base::StartsWith(FLAGS_key_server_url, "http",
|
||||||
|
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||||
LOG(WARNING) << "--signer is likely required with "
|
LOG(WARNING) << "--signer is likely required with "
|
||||||
"--enable_widevine_encryption/decryption.";
|
"--enable_widevine_encryption/decryption.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['clang==1', {
|
['clang==1', {
|
||||||
|
'cflags': [
|
||||||
|
# Temporary workaround a gtest bug on ImplicitCast_.
|
||||||
|
'-Wno-pessimizing-move',
|
||||||
|
],
|
||||||
# Revert the relevant settings in Chromium's common.gypi.
|
# Revert the relevant settings in Chromium's common.gypi.
|
||||||
'cflags!': [
|
'cflags!': [
|
||||||
'-Wno-char-subscripts',
|
'-Wno-char-subscripts',
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace media {
|
||||||
|
|
||||||
class AesCtrEncryptorTest : public testing::Test {
|
class AesCtrEncryptorTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
key_.assign(kAesKey, kAesKey + arraysize(kAesKey));
|
key_.assign(kAesKey, kAesKey + arraysize(kAesKey));
|
||||||
iv_.assign(kAesIv, kAesIv + arraysize(kAesIv));
|
iv_.assign(kAesIv, kAesIv + arraysize(kAesIv));
|
||||||
plaintext_.assign(kAesCtrPlaintext,
|
plaintext_.assign(kAesCtrPlaintext,
|
||||||
|
@ -400,7 +400,7 @@ TEST_F(AesCbcPkcs5EncryptorTestEncryptionDecryption, EncryptAES192CBCRegression)
|
||||||
|
|
||||||
class AesCbcPkcs5EncryptorTest : public testing::Test {
|
class AesCbcPkcs5EncryptorTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
const std::string kKey = "128=SixteenBytes";
|
const std::string kKey = "128=SixteenBytes";
|
||||||
const std::string kIv = "Sweet Sixteen IV";
|
const std::string kIv = "Sweet Sixteen IV";
|
||||||
key_.assign(kKey.begin(), kKey.end());
|
key_.assign(kKey.begin(), kKey.end());
|
||||||
|
@ -443,7 +443,7 @@ TEST_F(AesCbcPkcs5EncryptorTest, CipherTextNotMultipleOfBlockSize) {
|
||||||
|
|
||||||
class AesCbcCtsEncryptorDecryptorTest : public testing::Test {
|
class AesCbcCtsEncryptorDecryptorTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
key_.assign(kAesKey, kAesKey + arraysize(kAesKey));
|
key_.assign(kAesKey, kAesKey + arraysize(kAesKey));
|
||||||
iv_.assign(kAesIv, kAesIv + arraysize(kAesIv));
|
iv_.assign(kAesIv, kAesIv + arraysize(kAesIv));
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ class AudioStreamInfo : public StreamInfo {
|
||||||
|
|
||||||
/// @name StreamInfo implementation overrides.
|
/// @name StreamInfo implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool IsValidConfig() const OVERRIDE;
|
bool IsValidConfig() const override;
|
||||||
virtual std::string ToString() const OVERRIDE;
|
std::string ToString() const override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
AudioCodec codec() const { return codec_; }
|
AudioCodec codec() const { return codec_; }
|
||||||
|
@ -76,7 +76,7 @@ class AudioStreamInfo : public StreamInfo {
|
||||||
uint8_t audio_object_type);
|
uint8_t audio_object_type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~AudioStreamInfo();
|
~AudioStreamInfo() override;
|
||||||
|
|
||||||
AudioCodec codec_;
|
AudioCodec codec_;
|
||||||
uint8_t sample_bits_;
|
uint8_t sample_bits_;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/memory/scoped_ptr.h"
|
#include "packager/base/memory/scoped_ptr.h"
|
||||||
#include "packager/media/base/buffer_reader.h"
|
#include "packager/media/base/buffer_reader.h"
|
||||||
#include "packager/media/base/test/status_test_util.h"
|
#include "packager/media/base/test/status_test_util.h"
|
||||||
|
|
|
@ -33,11 +33,11 @@ class ClosureThread : public base::SimpleThread {
|
||||||
const base::Closure& task);
|
const base::Closure& task);
|
||||||
|
|
||||||
/// The destructor calls Join automatically if it is not yet joined.
|
/// The destructor calls Join automatically if it is not yet joined.
|
||||||
virtual ~ClosureThread();
|
~ClosureThread() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// SimpleThread implementation overrides.
|
/// SimpleThread implementation overrides.
|
||||||
virtual void Run() OVERRIDE;
|
void Run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const base::Closure task_;
|
const base::Closure task_;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ClosureThreadTest : public ::testing::Test {
|
||||||
base::Unretained(this)))),
|
base::Unretained(this)))),
|
||||||
val_(0) {}
|
val_(0) {}
|
||||||
|
|
||||||
virtual ~ClosureThreadTest() {}
|
~ClosureThreadTest() override {}
|
||||||
|
|
||||||
void ClosureCallback() {
|
void ClosureCallback() {
|
||||||
// Exit the loop if DoSomething return false.
|
// Exit the loop if DoSomething return false.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/media/base/container_names.h"
|
#include "packager/media/base/container_names.h"
|
||||||
#include "packager/media/test/test_data_util.h"
|
#include "packager/media/test/test_data_util.h"
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,12 @@ class HttpKeyFetcher : public KeyFetcher {
|
||||||
/// Create a fetcher with timeout.
|
/// Create a fetcher with timeout.
|
||||||
/// @param timeout_in_seconds specifies the timeout in seconds.
|
/// @param timeout_in_seconds specifies the timeout in seconds.
|
||||||
HttpKeyFetcher(uint32_t timeout_in_seconds);
|
HttpKeyFetcher(uint32_t timeout_in_seconds);
|
||||||
virtual ~HttpKeyFetcher();
|
~HttpKeyFetcher() override;
|
||||||
|
|
||||||
/// @name KeyFetcher implementation overrides.
|
/// @name KeyFetcher implementation overrides.
|
||||||
virtual Status FetchKeys(const std::string& url,
|
Status FetchKeys(const std::string& url,
|
||||||
const std::string& request,
|
const std::string& request,
|
||||||
std::string* response) OVERRIDE;
|
std::string* response) override;
|
||||||
|
|
||||||
/// Fetch content using HTTP GET.
|
/// Fetch content using HTTP GET.
|
||||||
/// @param url specifies the content URL.
|
/// @param url specifies the content URL.
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace media {
|
||||||
|
|
||||||
class OffsetByteQueueTest : public testing::Test {
|
class OffsetByteQueueTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
uint8_t buf[256];
|
uint8_t buf[256];
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
buf[i] = i;
|
buf[i] = i;
|
||||||
|
|
|
@ -185,11 +185,11 @@ class MultiThreadProducerConsumerQueueTest : public ::testing::Test {
|
||||||
base::Bind(&MultiThreadProducerConsumerQueueTest::PushTask,
|
base::Bind(&MultiThreadProducerConsumerQueueTest::PushTask,
|
||||||
base::Unretained(this))),
|
base::Unretained(this))),
|
||||||
queue_(kCapacity) {}
|
queue_(kCapacity) {}
|
||||||
virtual ~MultiThreadProducerConsumerQueueTest() {}
|
~MultiThreadProducerConsumerQueueTest() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() OVERRIDE { thread_.Start(); }
|
void SetUp() override { thread_.Start(); }
|
||||||
virtual void TearDown() OVERRIDE { thread_.Join(); }
|
void TearDown() override { thread_.Join(); }
|
||||||
|
|
||||||
void PushTask() {
|
void PushTask() {
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
@ -302,7 +302,7 @@ class MultiThreadProducerConsumerQueueStopTest
|
||||||
: public ::testing::TestWithParam<Operation> {
|
: public ::testing::TestWithParam<Operation> {
|
||||||
public:
|
public:
|
||||||
MultiThreadProducerConsumerQueueStopTest() : queue_(1), event_(true, false) {}
|
MultiThreadProducerConsumerQueueStopTest() : queue_(1), event_(true, false) {}
|
||||||
virtual ~MultiThreadProducerConsumerQueueStopTest() {}
|
~MultiThreadProducerConsumerQueueStopTest() override {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void ClosureTask(Operation op) {
|
void ClosureTask(Operation op) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class RequestSigner {
|
||||||
/// AesRequestSigner uses AES-CBC signing.
|
/// AesRequestSigner uses AES-CBC signing.
|
||||||
class AesRequestSigner : public RequestSigner {
|
class AesRequestSigner : public RequestSigner {
|
||||||
public:
|
public:
|
||||||
virtual ~AesRequestSigner();
|
~AesRequestSigner() override;
|
||||||
|
|
||||||
/// Create an AesSigner object from key and iv in hex.
|
/// Create an AesSigner object from key and iv in hex.
|
||||||
/// @return The created AesRequestSigner object on success, NULL otherwise.
|
/// @return The created AesRequestSigner object on success, NULL otherwise.
|
||||||
|
@ -51,8 +51,8 @@ class AesRequestSigner : public RequestSigner {
|
||||||
const std::string& iv_hex);
|
const std::string& iv_hex);
|
||||||
|
|
||||||
/// RequestSigner implementation override.
|
/// RequestSigner implementation override.
|
||||||
virtual bool GenerateSignature(const std::string& message,
|
bool GenerateSignature(const std::string& message,
|
||||||
std::string* signature) OVERRIDE;
|
std::string* signature) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AesRequestSigner(const std::string& signer_name,
|
AesRequestSigner(const std::string& signer_name,
|
||||||
|
@ -66,7 +66,7 @@ class AesRequestSigner : public RequestSigner {
|
||||||
/// RsaRequestSigner uses RSA-PSS signing.
|
/// RsaRequestSigner uses RSA-PSS signing.
|
||||||
class RsaRequestSigner : public RequestSigner {
|
class RsaRequestSigner : public RequestSigner {
|
||||||
public:
|
public:
|
||||||
virtual ~RsaRequestSigner();
|
~RsaRequestSigner() override;
|
||||||
|
|
||||||
/// Create an RsaSigner object using a DER encoded PKCS#1 RSAPrivateKey.
|
/// Create an RsaSigner object using a DER encoded PKCS#1 RSAPrivateKey.
|
||||||
/// @return The created RsaRequestSigner object on success, NULL otherwise.
|
/// @return The created RsaRequestSigner object on success, NULL otherwise.
|
||||||
|
@ -74,8 +74,8 @@ class RsaRequestSigner : public RequestSigner {
|
||||||
const std::string& pkcs1_rsa_key);
|
const std::string& pkcs1_rsa_key);
|
||||||
|
|
||||||
/// RequestSigner implementation override.
|
/// RequestSigner implementation override.
|
||||||
virtual bool GenerateSignature(const std::string& message,
|
bool GenerateSignature(const std::string& message,
|
||||||
std::string* signature) OVERRIDE;
|
std::string* signature) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsaRequestSigner(const std::string& signer_name,
|
RsaRequestSigner(const std::string& signer_name,
|
||||||
|
|
|
@ -20,7 +20,7 @@ class RsaKeyTest : public ::testing::TestWithParam<RsaTestSet> {
|
||||||
public:
|
public:
|
||||||
RsaKeyTest() : test_set_(GetParam()) {}
|
RsaKeyTest() : test_set_(GetParam()) {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
// Make OpenSSL RSA deterministic.
|
// Make OpenSSL RSA deterministic.
|
||||||
ASSERT_TRUE(fake_prng::StartFakePrng());
|
ASSERT_TRUE(fake_prng::StartFakePrng());
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class RsaKeyTest : public ::testing::TestWithParam<RsaTestSet> {
|
||||||
public_key_.reset(RsaPublicKey::Create(test_set_.public_key));
|
public_key_.reset(RsaPublicKey::Create(test_set_.public_key));
|
||||||
ASSERT_TRUE(public_key_ != NULL);
|
ASSERT_TRUE(public_key_ != NULL);
|
||||||
}
|
}
|
||||||
virtual void TearDown() { fake_prng::StopFakePrng(); }
|
void TearDown() override { fake_prng::StopFakePrng(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const RsaTestSet& test_set_;
|
const RsaTestSet& test_set_;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/logging.h"
|
#include "packager/base/logging.h"
|
||||||
#include "packager/media/test/test_data_util.h"
|
#include "packager/media/test/test_data_util.h"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ enum TextKind {
|
||||||
|
|
||||||
class TextTrack {
|
class TextTrack {
|
||||||
public:
|
public:
|
||||||
virtual ~TextTrack() {}
|
~TextTrack() override {}
|
||||||
virtual void addWebVTTCue(const base::TimeDelta& start,
|
virtual void addWebVTTCue(const base::TimeDelta& start,
|
||||||
const base::TimeDelta& end,
|
const base::TimeDelta& end,
|
||||||
const std::string& id,
|
const std::string& id,
|
||||||
|
|
|
@ -104,7 +104,7 @@ std::string VideoStreamInfo::GetCodecString(VideoCodec codec,
|
||||||
case kCodecH264: {
|
case kCodecH264: {
|
||||||
const uint8_t bytes[] = {profile, compatible_profiles, level};
|
const uint8_t bytes[] = {profile, compatible_profiles, level};
|
||||||
return "avc1." +
|
return "avc1." +
|
||||||
StringToLowerASCII(base::HexEncode(bytes, arraysize(bytes)));
|
base::StringToLowerASCII(base::HexEncode(bytes, arraysize(bytes)));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
NOTIMPLEMENTED() << "Unknown Codec: " << codec;
|
NOTIMPLEMENTED() << "Unknown Codec: " << codec;
|
||||||
|
|
|
@ -51,8 +51,8 @@ class VideoStreamInfo : public StreamInfo {
|
||||||
|
|
||||||
/// @name StreamInfo implementation overrides.
|
/// @name StreamInfo implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool IsValidConfig() const OVERRIDE;
|
bool IsValidConfig() const override;
|
||||||
virtual std::string ToString() const OVERRIDE;
|
std::string ToString() const override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
VideoCodec codec() const { return codec_; }
|
VideoCodec codec() const { return codec_; }
|
||||||
|
@ -80,7 +80,7 @@ class VideoStreamInfo : public StreamInfo {
|
||||||
uint8_t level);
|
uint8_t level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~VideoStreamInfo();
|
~VideoStreamInfo() override;
|
||||||
|
|
||||||
VideoCodec codec_;
|
VideoCodec codec_;
|
||||||
uint16_t width_;
|
uint16_t width_;
|
||||||
|
|
|
@ -386,7 +386,7 @@ void WidevineKeySource::FillRequest(bool enable_key_rotation,
|
||||||
request_dict_.SetInteger("crypto_period_count", crypto_period_count_);
|
request_dict_.SetInteger("crypto_period_count", crypto_period_count_);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::JSONWriter::Write(&request_dict_, request);
|
base::JSONWriter::Write(request_dict_, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status WidevineKeySource::GenerateKeyMessage(const std::string& request,
|
Status WidevineKeySource::GenerateKeyMessage(const std::string& request,
|
||||||
|
@ -412,7 +412,7 @@ Status WidevineKeySource::GenerateKeyMessage(const std::string& request,
|
||||||
request_dict.SetString("signer", signer_->signer_name());
|
request_dict.SetString("signer", signer_->signer_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
base::JSONWriter::Write(&request_dict, message);
|
base::JSONWriter::Write(request_dict, message);
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,22 +28,22 @@ class WidevineKeySource : public KeySource {
|
||||||
/// @param server_url is the Widevine common encryption server url.
|
/// @param server_url is the Widevine common encryption server url.
|
||||||
explicit WidevineKeySource(const std::string& server_url);
|
explicit WidevineKeySource(const std::string& server_url);
|
||||||
|
|
||||||
virtual ~WidevineKeySource();
|
~WidevineKeySource() override;
|
||||||
|
|
||||||
/// @name KeySource implementation overrides.
|
/// @name KeySource implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual Status FetchKeys(const std::vector<uint8_t>& content_id,
|
Status FetchKeys(const std::vector<uint8_t>& content_id,
|
||||||
const std::string& policy) OVERRIDE;
|
const std::string& policy) override;
|
||||||
virtual Status FetchKeys(const std::vector<uint8_t>& pssh_data) OVERRIDE;
|
Status FetchKeys(const std::vector<uint8_t>& pssh_data) override;
|
||||||
virtual Status FetchKeys(uint32_t asset_id) OVERRIDE;
|
Status FetchKeys(uint32_t asset_id) override;
|
||||||
|
|
||||||
virtual Status GetKey(TrackType track_type, EncryptionKey* key) OVERRIDE;
|
Status GetKey(TrackType track_type, EncryptionKey* key) override;
|
||||||
virtual Status GetKey(const std::vector<uint8_t>& key_id,
|
Status GetKey(const std::vector<uint8_t>& key_id,
|
||||||
EncryptionKey* key) OVERRIDE;
|
EncryptionKey* key) override;
|
||||||
virtual Status GetCryptoPeriodKey(uint32_t crypto_period_index,
|
Status GetCryptoPeriodKey(uint32_t crypto_period_index,
|
||||||
TrackType track_type,
|
TrackType track_type,
|
||||||
EncryptionKey* key) OVERRIDE;
|
EncryptionKey* key) override;
|
||||||
virtual std::string UUID() OVERRIDE;
|
std::string UUID() override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Set signer for the key source.
|
/// Set signer for the key source.
|
||||||
|
|
|
@ -120,7 +120,7 @@ class MockRequestSigner : public RequestSigner {
|
||||||
public:
|
public:
|
||||||
explicit MockRequestSigner(const std::string& signer_name)
|
explicit MockRequestSigner(const std::string& signer_name)
|
||||||
: RequestSigner(signer_name) {}
|
: RequestSigner(signer_name) {}
|
||||||
virtual ~MockRequestSigner() {}
|
~MockRequestSigner() override {}
|
||||||
|
|
||||||
MOCK_METHOD2(GenerateSignature,
|
MOCK_METHOD2(GenerateSignature,
|
||||||
bool(const std::string& message, std::string* signature));
|
bool(const std::string& message, std::string* signature));
|
||||||
|
@ -132,7 +132,7 @@ class MockRequestSigner : public RequestSigner {
|
||||||
class MockKeyFetcher : public KeyFetcher {
|
class MockKeyFetcher : public KeyFetcher {
|
||||||
public:
|
public:
|
||||||
MockKeyFetcher() : KeyFetcher() {}
|
MockKeyFetcher() : KeyFetcher() {}
|
||||||
virtual ~MockKeyFetcher() {}
|
~MockKeyFetcher() override {}
|
||||||
|
|
||||||
MOCK_METHOD3(FetchKeys,
|
MOCK_METHOD3(FetchKeys,
|
||||||
Status(const std::string& service_address,
|
Status(const std::string& service_address,
|
||||||
|
@ -149,7 +149,7 @@ class WidevineKeySourceTest : public ::testing::Test {
|
||||||
: mock_request_signer_(new MockRequestSigner(kSignerName)),
|
: mock_request_signer_(new MockRequestSigner(kSignerName)),
|
||||||
mock_key_fetcher_(new MockKeyFetcher()) {}
|
mock_key_fetcher_(new MockKeyFetcher()) {}
|
||||||
|
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
content_id_.assign(
|
content_id_.assign(
|
||||||
reinterpret_cast<const uint8_t*>(kContentId),
|
reinterpret_cast<const uint8_t*>(kContentId),
|
||||||
reinterpret_cast<const uint8_t*>(kContentId) + strlen(kContentId));
|
reinterpret_cast<const uint8_t*>(kContentId) + strlen(kContentId));
|
||||||
|
@ -158,8 +158,7 @@ class WidevineKeySourceTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void CreateWidevineKeySource() {
|
void CreateWidevineKeySource() {
|
||||||
widevine_key_source_.reset(new WidevineKeySource(kServerUrl));
|
widevine_key_source_.reset(new WidevineKeySource(kServerUrl));
|
||||||
widevine_key_source_->set_key_fetcher(
|
widevine_key_source_->set_key_fetcher(mock_key_fetcher_.Pass());
|
||||||
mock_key_fetcher_.PassAs<KeyFetcher>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerifyKeys(bool classic) {
|
void VerifyKeys(bool classic) {
|
||||||
|
@ -203,8 +202,7 @@ TEST_F(WidevineKeySourceTest, GenerateSignatureFailure) {
|
||||||
.WillOnce(Return(false));
|
.WillOnce(Return(false));
|
||||||
|
|
||||||
CreateWidevineKeySource();
|
CreateWidevineKeySource();
|
||||||
widevine_key_source_->set_signer(
|
widevine_key_source_->set_signer(mock_request_signer_.Pass());
|
||||||
mock_request_signer_.PassAs<RequestSigner>());
|
|
||||||
ASSERT_EQ(Status(error::INTERNAL_ERROR, "Signature generation failed."),
|
ASSERT_EQ(Status(error::INTERNAL_ERROR, "Signature generation failed."),
|
||||||
widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
||||||
}
|
}
|
||||||
|
@ -228,8 +226,7 @@ TEST_F(WidevineKeySourceTest, HttpFetchFailure) {
|
||||||
.WillOnce(Return(kMockStatus));
|
.WillOnce(Return(kMockStatus));
|
||||||
|
|
||||||
CreateWidevineKeySource();
|
CreateWidevineKeySource();
|
||||||
widevine_key_source_->set_signer(
|
widevine_key_source_->set_signer(mock_request_signer_.Pass());
|
||||||
mock_request_signer_.PassAs<RequestSigner>());
|
|
||||||
ASSERT_EQ(kMockStatus,
|
ASSERT_EQ(kMockStatus,
|
||||||
widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
||||||
}
|
}
|
||||||
|
@ -417,8 +414,7 @@ TEST_F(WidevineKeySourceTest, KeyRotationTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateWidevineKeySource();
|
CreateWidevineKeySource();
|
||||||
widevine_key_source_->set_signer(
|
widevine_key_source_->set_signer(mock_request_signer_.Pass());
|
||||||
mock_request_signer_.PassAs<RequestSigner>());
|
|
||||||
ASSERT_OK(widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
ASSERT_OK(widevine_key_source_->FetchKeys(content_id_, kPolicy));
|
||||||
|
|
||||||
EncryptionKey encryption_key;
|
EncryptionKey encryption_key;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class MpdNotifyMuxerListener : public MuxerListener {
|
||||||
/// @param mpd_notifier must be initialized, i.e mpd_notifier->Init() must be
|
/// @param mpd_notifier must be initialized, i.e mpd_notifier->Init() must be
|
||||||
/// called.
|
/// called.
|
||||||
explicit MpdNotifyMuxerListener(MpdNotifier* mpd_notifier);
|
explicit MpdNotifyMuxerListener(MpdNotifier* mpd_notifier);
|
||||||
virtual ~MpdNotifyMuxerListener();
|
~MpdNotifyMuxerListener() override;
|
||||||
|
|
||||||
/// If the stream is encrypted use this as 'schemeIdUri' attribute for
|
/// If the stream is encrypted use this as 'schemeIdUri' attribute for
|
||||||
/// ContentProtection element.
|
/// ContentProtection element.
|
||||||
|
@ -37,28 +37,27 @@ class MpdNotifyMuxerListener : public MuxerListener {
|
||||||
|
|
||||||
/// @name MuxerListener implementation overrides.
|
/// @name MuxerListener implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual void OnEncryptionInfoReady(
|
void OnEncryptionInfoReady(bool is_initial_encryption_info,
|
||||||
bool is_initial_encryption_info,
|
|
||||||
const std::string& content_protection_uuid,
|
const std::string& content_protection_uuid,
|
||||||
const std::string& content_protection_name_version,
|
const std::string& content_protection_name_version,
|
||||||
const std::vector<uint8_t>& key_id,
|
const std::vector<uint8_t>& key_id,
|
||||||
const std::vector<uint8_t>& pssh) OVERRIDE;
|
const std::vector<uint8_t>& pssh) override;
|
||||||
virtual void OnMediaStart(const MuxerOptions& muxer_options,
|
void OnMediaStart(const MuxerOptions& muxer_options,
|
||||||
const StreamInfo& stream_info,
|
const StreamInfo& stream_info,
|
||||||
uint32_t time_scale,
|
uint32_t time_scale,
|
||||||
ContainerType container_type) OVERRIDE;
|
ContainerType container_type) override;
|
||||||
virtual void OnSampleDurationReady(uint32_t sample_duration) OVERRIDE;
|
void OnSampleDurationReady(uint32_t sample_duration) override;
|
||||||
virtual void OnMediaEnd(bool has_init_range,
|
void OnMediaEnd(bool has_init_range,
|
||||||
uint64_t init_range_start,
|
uint64_t init_range_start,
|
||||||
uint64_t init_range_end,
|
uint64_t init_range_end,
|
||||||
bool has_index_range,
|
bool has_index_range,
|
||||||
uint64_t index_range_start,
|
uint64_t index_range_start,
|
||||||
uint64_t index_range_end,
|
uint64_t index_range_end,
|
||||||
float duration_seconds,
|
float duration_seconds,
|
||||||
uint64_t file_size) OVERRIDE;
|
uint64_t file_size) override;
|
||||||
virtual void OnNewSegment(uint64_t start_time,
|
void OnNewSegment(uint64_t start_time,
|
||||||
uint64_t duration,
|
uint64_t duration,
|
||||||
uint64_t segment_file_size) OVERRIDE;
|
uint64_t segment_file_size) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace media {
|
||||||
class VodMediaInfoDumpMuxerListener : public MuxerListener {
|
class VodMediaInfoDumpMuxerListener : public MuxerListener {
|
||||||
public:
|
public:
|
||||||
VodMediaInfoDumpMuxerListener(const std::string& output_file_name);
|
VodMediaInfoDumpMuxerListener(const std::string& output_file_name);
|
||||||
virtual ~VodMediaInfoDumpMuxerListener();
|
~VodMediaInfoDumpMuxerListener() override;
|
||||||
|
|
||||||
/// If the stream is encrypted use this as 'schemeIdUri' attribute for
|
/// If the stream is encrypted use this as 'schemeIdUri' attribute for
|
||||||
/// ContentProtection element.
|
/// ContentProtection element.
|
||||||
|
@ -36,29 +36,27 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
|
||||||
|
|
||||||
/// @name MuxerListener implementation overrides.
|
/// @name MuxerListener implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual void OnEncryptionInfoReady(
|
void OnEncryptionInfoReady(bool is_initial_encryption_info,
|
||||||
bool is_initial_encryption_info,
|
|
||||||
const std::string& content_protection_uuid,
|
const std::string& content_protection_uuid,
|
||||||
const std::string& content_protection_name_version,
|
const std::string& content_protection_name_version,
|
||||||
const std::vector<uint8_t>& default_key_id,
|
const std::vector<uint8_t>& default_key_id,
|
||||||
const std::vector<uint8_t>& pssh) OVERRIDE;
|
const std::vector<uint8_t>& pssh) override;
|
||||||
virtual void OnMediaStart(
|
void OnMediaStart(const MuxerOptions& muxer_options,
|
||||||
const MuxerOptions& muxer_options,
|
|
||||||
const StreamInfo& stream_info,
|
const StreamInfo& stream_info,
|
||||||
uint32_t time_scale,
|
uint32_t time_scale,
|
||||||
ContainerType container_type) OVERRIDE;
|
ContainerType container_type) override;
|
||||||
virtual void OnSampleDurationReady(uint32_t sample_duration) OVERRIDE;
|
void OnSampleDurationReady(uint32_t sample_duration) override;
|
||||||
virtual void OnMediaEnd(bool has_init_range,
|
void OnMediaEnd(bool has_init_range,
|
||||||
uint64_t init_range_start,
|
uint64_t init_range_start,
|
||||||
uint64_t init_range_end,
|
uint64_t init_range_end,
|
||||||
bool has_index_range,
|
bool has_index_range,
|
||||||
uint64_t index_range_start,
|
uint64_t index_range_start,
|
||||||
uint64_t index_range_end,
|
uint64_t index_range_end,
|
||||||
float duration_seconds,
|
float duration_seconds,
|
||||||
uint64_t file_size) OVERRIDE;
|
uint64_t file_size) override;
|
||||||
virtual void OnNewSegment(uint64_t start_time,
|
void OnNewSegment(uint64_t start_time,
|
||||||
uint64_t duration,
|
uint64_t duration,
|
||||||
uint64_t segment_file_size) OVERRIDE;
|
uint64_t segment_file_size) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/files/file_path.h"
|
#include "packager/base/files/file_path.h"
|
||||||
#include "packager/media/base/muxer_options.h"
|
#include "packager/media/base/muxer_options.h"
|
||||||
#include "packager/media/base/video_stream_info.h"
|
#include "packager/media/base/video_stream_info.h"
|
||||||
|
@ -61,16 +61,16 @@ void ExpectTextFormatMediaInfoEqual(const std::string& expect,
|
||||||
class VodMediaInfoDumpMuxerListenerTest : public ::testing::Test {
|
class VodMediaInfoDumpMuxerListenerTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
VodMediaInfoDumpMuxerListenerTest() {}
|
VodMediaInfoDumpMuxerListenerTest() {}
|
||||||
virtual ~VodMediaInfoDumpMuxerListenerTest() {}
|
~VodMediaInfoDumpMuxerListenerTest() override {}
|
||||||
|
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
||||||
DLOG(INFO) << "Created temp file: " << temp_file_path_.value();
|
DLOG(INFO) << "Created temp file: " << temp_file_path_.value();
|
||||||
|
|
||||||
listener_.reset(new VodMediaInfoDumpMuxerListener(temp_file_path_.value()));
|
listener_.reset(new VodMediaInfoDumpMuxerListener(temp_file_path_.value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() OVERRIDE {
|
void TearDown() override {
|
||||||
base::DeleteFile(temp_file_path_, false);
|
base::DeleteFile(temp_file_path_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/media/file/file.h"
|
#include "packager/media/file/file.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -18,7 +18,7 @@ namespace media {
|
||||||
|
|
||||||
class LocalFileTest : public testing::Test {
|
class LocalFileTest : public testing::Test {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
data_.resize(kDataSize);
|
data_.resize(kDataSize);
|
||||||
for (int i = 0; i < kDataSize; ++i)
|
for (int i = 0; i < kDataSize; ++i)
|
||||||
data_[i] = i % 256;
|
data_[i] = i % 256;
|
||||||
|
@ -32,7 +32,7 @@ class LocalFileTest : public testing::Test {
|
||||||
local_file_name_ += local_file_name_no_prefix_;
|
local_file_name_ += local_file_name_no_prefix_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
// Remove test file if created.
|
// Remove test file if created.
|
||||||
base::DeleteFile(base::FilePath(local_file_name_no_prefix_), false);
|
base::DeleteFile(base::FilePath(local_file_name_no_prefix_), false);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ TEST_F(LocalFileTest, ReadNotExist) {
|
||||||
|
|
||||||
TEST_F(LocalFileTest, Size) {
|
TEST_F(LocalFileTest, Size) {
|
||||||
ASSERT_EQ(kDataSize,
|
ASSERT_EQ(kDataSize,
|
||||||
file_util::WriteFile(test_file_path_, data_.data(), kDataSize));
|
base::WriteFile(test_file_path_, data_.data(), kDataSize));
|
||||||
ASSERT_EQ(kDataSize, File::GetFileSize(local_file_name_.c_str()));
|
ASSERT_EQ(kDataSize, File::GetFileSize(local_file_name_.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ TEST_F(LocalFileTest, Write) {
|
||||||
TEST_F(LocalFileTest, Read_And_Eof) {
|
TEST_F(LocalFileTest, Read_And_Eof) {
|
||||||
// Write file using file_util API.
|
// Write file using file_util API.
|
||||||
ASSERT_EQ(kDataSize,
|
ASSERT_EQ(kDataSize,
|
||||||
file_util::WriteFile(test_file_path_, data_.data(), kDataSize));
|
base::WriteFile(test_file_path_, data_.data(), kDataSize));
|
||||||
|
|
||||||
// Read file using File API.
|
// Read file using File API.
|
||||||
File* file = File::Open(local_file_name_.c_str(), "r");
|
File* file = File::Open(local_file_name_.c_str(), "r");
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace media {
|
||||||
class IoCache {
|
class IoCache {
|
||||||
public:
|
public:
|
||||||
explicit IoCache(uint64_t cache_size);
|
explicit IoCache(uint64_t cache_size);
|
||||||
virtual ~IoCache();
|
~IoCache();
|
||||||
|
|
||||||
/// Read data from the cache. This function may block until there is data in
|
/// Read data from the cache. This function may block until there is data in
|
||||||
/// the cache.
|
/// the cache.
|
||||||
|
|
|
@ -46,14 +46,14 @@ class IoCacheTest : public testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
for (unsigned int idx = 0; idx < kBlockSize; ++idx)
|
for (unsigned int idx = 0; idx < kBlockSize; ++idx)
|
||||||
reference_block_[idx] = idx;
|
reference_block_[idx] = idx;
|
||||||
cache_.reset(new IoCache(kCacheSize));
|
cache_.reset(new IoCache(kCacheSize));
|
||||||
cache_closed_ = false;
|
cache_closed_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() OVERRIDE {
|
void TearDown() override {
|
||||||
WaitForWriterThread();
|
WaitForWriterThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/logging.h"
|
#include "packager/base/logging.h"
|
||||||
|
|
||||||
namespace edash_packager {
|
namespace edash_packager {
|
||||||
|
|
|
@ -27,13 +27,13 @@ class LocalFile : public File {
|
||||||
|
|
||||||
/// @name File implementation overrides.
|
/// @name File implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool Close() OVERRIDE;
|
bool Close() override;
|
||||||
virtual int64_t Read(void* buffer, uint64_t length) OVERRIDE;
|
int64_t Read(void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
int64_t Write(const void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Size() OVERRIDE;
|
int64_t Size() override;
|
||||||
virtual bool Flush() OVERRIDE;
|
bool Flush() override;
|
||||||
virtual bool Seek(uint64_t position) OVERRIDE;
|
bool Seek(uint64_t position) override;
|
||||||
virtual bool Tell(uint64_t* position) OVERRIDE;
|
bool Tell(uint64_t* position) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Delete a local file.
|
/// Delete a local file.
|
||||||
|
@ -42,9 +42,9 @@ class LocalFile : public File {
|
||||||
static bool Delete(const char* file_name);
|
static bool Delete(const char* file_name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~LocalFile();
|
~LocalFile() override;
|
||||||
|
|
||||||
virtual bool Open() OVERRIDE;
|
bool Open() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string file_mode_;
|
std::string file_mode_;
|
||||||
|
|
|
@ -33,19 +33,19 @@ class ThreadedIoFile : public File {
|
||||||
|
|
||||||
/// @name File implementation overrides.
|
/// @name File implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool Close() OVERRIDE;
|
bool Close() override;
|
||||||
virtual int64_t Read(void* buffer, uint64_t length) OVERRIDE;
|
int64_t Read(void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
int64_t Write(const void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Size() OVERRIDE;
|
int64_t Size() override;
|
||||||
virtual bool Flush() OVERRIDE;
|
bool Flush() override;
|
||||||
virtual bool Seek(uint64_t position) OVERRIDE;
|
bool Seek(uint64_t position) override;
|
||||||
virtual bool Tell(uint64_t* position) OVERRIDE;
|
bool Tell(uint64_t* position) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~ThreadedIoFile();
|
~ThreadedIoFile() override;
|
||||||
|
|
||||||
virtual bool Open() OVERRIDE;
|
bool Open() override;
|
||||||
|
|
||||||
void RunInInputMode();
|
void RunInInputMode();
|
||||||
void RunInOutputMode();
|
void RunInOutputMode();
|
||||||
|
|
|
@ -26,19 +26,19 @@ class UdpFile : public File {
|
||||||
|
|
||||||
/// @name File implementation overrides.
|
/// @name File implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool Close() OVERRIDE;
|
bool Close() override;
|
||||||
virtual int64_t Read(void* buffer, uint64_t length) OVERRIDE;
|
int64_t Read(void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
int64_t Write(const void* buffer, uint64_t length) override;
|
||||||
virtual int64_t Size() OVERRIDE;
|
int64_t Size() override;
|
||||||
virtual bool Flush() OVERRIDE;
|
bool Flush() override;
|
||||||
virtual bool Seek(uint64_t position) OVERRIDE;
|
bool Seek(uint64_t position) override;
|
||||||
virtual bool Tell(uint64_t* position) OVERRIDE;
|
bool Tell(uint64_t* position) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~UdpFile();
|
~UdpFile() override;
|
||||||
|
|
||||||
virtual bool Open() OVERRIDE;
|
bool Open() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int socket_;
|
int socket_;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace mp2t {
|
||||||
|
|
||||||
class AdtsHeaderTest : public testing::Test {
|
class AdtsHeaderTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
ASSERT_TRUE(base::HexStringToBytes(kValidAdtsFrame, &adts_frame_));
|
ASSERT_TRUE(base::HexStringToBytes(kValidAdtsFrame, &adts_frame_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@ namespace mp2t {
|
||||||
|
|
||||||
class EsParser {
|
class EsParser {
|
||||||
public:
|
public:
|
||||||
typedef base::Callback<void(scoped_refptr<StreamInfo>&)> NewStreamInfoCB;
|
typedef base::Callback<void(const scoped_refptr<StreamInfo>&)>
|
||||||
typedef base::Callback<void(uint32_t, scoped_refptr<MediaSample>&)>
|
NewStreamInfoCB;
|
||||||
|
typedef base::Callback<void(uint32_t, const scoped_refptr<MediaSample>&)>
|
||||||
EmitSampleCB;
|
EmitSampleCB;
|
||||||
|
|
||||||
EsParser(uint32_t pid) : pid_(pid) {}
|
EsParser(uint32_t pid) : pid_(pid) {}
|
||||||
|
|
|
@ -28,15 +28,12 @@ class EsParserAdts : public EsParser {
|
||||||
const NewStreamInfoCB& new_stream_info_cb,
|
const NewStreamInfoCB& new_stream_info_cb,
|
||||||
const EmitSampleCB& emit_sample_cb,
|
const EmitSampleCB& emit_sample_cb,
|
||||||
bool sbr_in_mimetype);
|
bool sbr_in_mimetype);
|
||||||
virtual ~EsParserAdts();
|
~EsParserAdts() override;
|
||||||
|
|
||||||
// EsParser implementation.
|
// EsParser implementation.
|
||||||
virtual bool Parse(const uint8_t* buf,
|
bool Parse(const uint8_t* buf, int size, int64_t pts, int64_t dts) override;
|
||||||
int size,
|
void Flush() override;
|
||||||
int64_t pts,
|
void Reset() override;
|
||||||
int64_t dts) OVERRIDE;
|
|
||||||
virtual void Flush() OVERRIDE;
|
|
||||||
virtual void Reset() OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Used to link a PTS with a byte position in the ES stream.
|
// Used to link a PTS with a byte position in the ES stream.
|
||||||
|
|
|
@ -35,15 +35,12 @@ class EsParserH264 : public EsParser {
|
||||||
EsParserH264(uint32_t pid,
|
EsParserH264(uint32_t pid,
|
||||||
const NewStreamInfoCB& new_stream_info_cb,
|
const NewStreamInfoCB& new_stream_info_cb,
|
||||||
const EmitSampleCB& emit_sample_cb);
|
const EmitSampleCB& emit_sample_cb);
|
||||||
virtual ~EsParserH264();
|
~EsParserH264() override;
|
||||||
|
|
||||||
// EsParser implementation overrides.
|
// EsParser implementation overrides.
|
||||||
virtual bool Parse(const uint8_t* buf,
|
bool Parse(const uint8_t* buf, int size, int64_t pts, int64_t dts) override;
|
||||||
int size,
|
void Flush() override;
|
||||||
int64_t pts,
|
void Reset() override;
|
||||||
int64_t dts) OVERRIDE;
|
|
||||||
virtual void Flush() OVERRIDE;
|
|
||||||
virtual void Reset() OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TimingDesc {
|
struct TimingDesc {
|
||||||
|
|
|
@ -125,13 +125,13 @@ class EsParserH264Test : public testing::Test {
|
||||||
void LoadStream(const char* filename);
|
void LoadStream(const char* filename);
|
||||||
void ProcessPesPackets(const std::vector<Packet>& pes_packets);
|
void ProcessPesPackets(const std::vector<Packet>& pes_packets);
|
||||||
|
|
||||||
void EmitSample(uint32_t pid, scoped_refptr<MediaSample>& sample) {
|
void EmitSample(uint32_t pid, const scoped_refptr<MediaSample>& sample) {
|
||||||
sample_count_++;
|
sample_count_++;
|
||||||
if (sample_count_ == 1)
|
if (sample_count_ == 1)
|
||||||
first_frame_is_key_frame_ = sample->is_key_frame();
|
first_frame_is_key_frame_ = sample->is_key_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewVideoConfig(scoped_refptr<StreamInfo>& config) {
|
void NewVideoConfig(const scoped_refptr<StreamInfo>& config) {
|
||||||
DVLOG(1) << config->ToString();
|
DVLOG(1) << config->ToString();
|
||||||
stream_map_[config->track_id()] = config;
|
stream_map_[config->track_id()] = config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class PidState {
|
||||||
PidType pid_type() const { return pid_type_; }
|
PidType pid_type() const { return pid_type_; }
|
||||||
|
|
||||||
scoped_refptr<StreamInfo>& config() { return config_; }
|
scoped_refptr<StreamInfo>& config() { return config_; }
|
||||||
void set_config(scoped_refptr<StreamInfo>& config) { config_ = config; }
|
void set_config(const scoped_refptr<StreamInfo>& config) { config_ = config; }
|
||||||
|
|
||||||
SampleQueue& sample_queue() { return sample_queue_; }
|
SampleQueue& sample_queue() { return sample_queue_; }
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ void Mp2tMediaParser::RegisterPes(int pmt_pid,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mp2tMediaParser::OnNewStreamInfo(
|
void Mp2tMediaParser::OnNewStreamInfo(
|
||||||
scoped_refptr<StreamInfo>& new_stream_info) {
|
const scoped_refptr<StreamInfo>& new_stream_info) {
|
||||||
DCHECK(new_stream_info);
|
DCHECK(new_stream_info);
|
||||||
DVLOG(1) << "OnVideoConfigChanged for pid=" << new_stream_info->track_id();
|
DVLOG(1) << "OnVideoConfigChanged for pid=" << new_stream_info->track_id();
|
||||||
|
|
||||||
|
@ -374,8 +374,9 @@ bool Mp2tMediaParser::FinishInitializationIfNeeded() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mp2tMediaParser::OnEmitSample(uint32_t pes_pid,
|
void Mp2tMediaParser::OnEmitSample(
|
||||||
scoped_refptr<MediaSample>& new_sample) {
|
uint32_t pes_pid,
|
||||||
|
const scoped_refptr<MediaSample>& new_sample) {
|
||||||
DCHECK(new_sample);
|
DCHECK(new_sample);
|
||||||
DVLOG(LOG_LEVEL_ES)
|
DVLOG(LOG_LEVEL_ES)
|
||||||
<< "OnEmitSample: "
|
<< "OnEmitSample: "
|
||||||
|
|
|
@ -30,16 +30,16 @@ typedef std::deque<scoped_refptr<MediaSample> > SampleQueue;
|
||||||
class Mp2tMediaParser : public MediaParser {
|
class Mp2tMediaParser : public MediaParser {
|
||||||
public:
|
public:
|
||||||
Mp2tMediaParser();
|
Mp2tMediaParser();
|
||||||
virtual ~Mp2tMediaParser();
|
~Mp2tMediaParser() override;
|
||||||
|
|
||||||
// MediaParser implementation overrides.
|
// MediaParser implementation overrides.
|
||||||
virtual void Init(const InitCB& init_cb,
|
void Init(const InitCB& init_cb,
|
||||||
const NewSampleCB& new_sample_cb,
|
const NewSampleCB& new_sample_cb,
|
||||||
KeySource* decryption_key_source) OVERRIDE;
|
KeySource* decryption_key_source) override;
|
||||||
|
|
||||||
virtual void Flush() OVERRIDE;
|
void Flush() override;
|
||||||
|
|
||||||
virtual bool Parse(const uint8_t* buf, int size) OVERRIDE;
|
bool Parse(const uint8_t* buf, int size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<int, PidState*> PidMap;
|
typedef std::map<int, PidState*> PidMap;
|
||||||
|
@ -56,11 +56,12 @@ class Mp2tMediaParser : public MediaParser {
|
||||||
|
|
||||||
// Callback invoked each time the audio/video decoder configuration is
|
// Callback invoked each time the audio/video decoder configuration is
|
||||||
// changed.
|
// changed.
|
||||||
void OnNewStreamInfo(scoped_refptr<StreamInfo>& new_stream_info);
|
void OnNewStreamInfo(const scoped_refptr<StreamInfo>& new_stream_info);
|
||||||
|
|
||||||
// Callback invoked by the ES media parser
|
// Callback invoked by the ES media parser
|
||||||
// to emit a new audio/video access unit.
|
// to emit a new audio/video access unit.
|
||||||
void OnEmitSample(uint32_t pes_pid, scoped_refptr<MediaSample>& new_sample);
|
void OnEmitSample(uint32_t pes_pid,
|
||||||
|
const scoped_refptr<MediaSample>& new_sample);
|
||||||
|
|
||||||
// Invoke the initialization callback if needed.
|
// Invoke the initialization callback if needed.
|
||||||
bool FinishInitializationIfNeeded();
|
bool FinishInitializationIfNeeded();
|
||||||
|
|
|
@ -19,11 +19,11 @@ class TsSectionPat : public TsSectionPsi {
|
||||||
typedef base::Callback<void(int, int)> RegisterPmtCb;
|
typedef base::Callback<void(int, int)> RegisterPmtCb;
|
||||||
|
|
||||||
explicit TsSectionPat(const RegisterPmtCb& register_pmt_cb);
|
explicit TsSectionPat(const RegisterPmtCb& register_pmt_cb);
|
||||||
virtual ~TsSectionPat();
|
~TsSectionPat() override;
|
||||||
|
|
||||||
// TsSectionPsi implementation.
|
// TsSectionPsi implementation.
|
||||||
virtual bool ParsePsiSection(BitReader* bit_reader) OVERRIDE;
|
bool ParsePsiSection(BitReader* bit_reader) override;
|
||||||
virtual void ResetPsiSection() OVERRIDE;
|
void ResetPsiSection() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RegisterPmtCb register_pmt_cb_;
|
RegisterPmtCb register_pmt_cb_;
|
||||||
|
|
|
@ -21,14 +21,14 @@ class EsParser;
|
||||||
class TsSectionPes : public TsSection {
|
class TsSectionPes : public TsSection {
|
||||||
public:
|
public:
|
||||||
explicit TsSectionPes(scoped_ptr<EsParser> es_parser);
|
explicit TsSectionPes(scoped_ptr<EsParser> es_parser);
|
||||||
virtual ~TsSectionPes();
|
~TsSectionPes() override;
|
||||||
|
|
||||||
// TsSection implementation.
|
// TsSection implementation.
|
||||||
virtual bool Parse(bool payload_unit_start_indicator,
|
bool Parse(bool payload_unit_start_indicator,
|
||||||
const uint8_t* buf,
|
const uint8_t* buf,
|
||||||
int size) OVERRIDE;
|
int size) override;
|
||||||
virtual void Flush() OVERRIDE;
|
void Flush() override;
|
||||||
virtual void Reset() OVERRIDE;
|
void Reset() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Emit a reassembled PES packet.
|
// Emit a reassembled PES packet.
|
||||||
|
|
|
@ -21,11 +21,11 @@ class TsSectionPmt : public TsSectionPsi {
|
||||||
typedef base::Callback<void(int, int)> RegisterPesCb;
|
typedef base::Callback<void(int, int)> RegisterPesCb;
|
||||||
|
|
||||||
explicit TsSectionPmt(const RegisterPesCb& register_pes_cb);
|
explicit TsSectionPmt(const RegisterPesCb& register_pes_cb);
|
||||||
virtual ~TsSectionPmt();
|
~TsSectionPmt() override;
|
||||||
|
|
||||||
// Mpeg2TsPsiParser implementation.
|
// Mpeg2TsPsiParser implementation.
|
||||||
virtual bool ParsePsiSection(BitReader* bit_reader) OVERRIDE;
|
bool ParsePsiSection(BitReader* bit_reader) override;
|
||||||
virtual void ResetPsiSection() OVERRIDE;
|
void ResetPsiSection() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RegisterPesCb register_pes_cb_;
|
RegisterPesCb register_pes_cb_;
|
||||||
|
|
|
@ -19,14 +19,14 @@ namespace mp2t {
|
||||||
class TsSectionPsi : public TsSection {
|
class TsSectionPsi : public TsSection {
|
||||||
public:
|
public:
|
||||||
TsSectionPsi();
|
TsSectionPsi();
|
||||||
virtual ~TsSectionPsi();
|
~TsSectionPsi() override;
|
||||||
|
|
||||||
// TsSection implementation.
|
// TsSection implementation.
|
||||||
virtual bool Parse(bool payload_unit_start_indicator,
|
bool Parse(bool payload_unit_start_indicator,
|
||||||
const uint8_t* buf,
|
const uint8_t* buf,
|
||||||
int size) OVERRIDE;
|
int size) override;
|
||||||
virtual void Flush() OVERRIDE;
|
void Flush() override;
|
||||||
virtual void Reset() OVERRIDE;
|
void Reset() override;
|
||||||
|
|
||||||
// Parse the content of the PSI section.
|
// Parse the content of the PSI section.
|
||||||
virtual bool ParsePsiSection(BitReader* bit_reader) = 0;
|
virtual bool ParsePsiSection(BitReader* bit_reader) = 0;
|
||||||
|
|
|
@ -58,13 +58,13 @@ struct Box {
|
||||||
struct FullBox : Box {
|
struct FullBox : Box {
|
||||||
public:
|
public:
|
||||||
FullBox();
|
FullBox();
|
||||||
virtual ~FullBox();
|
~FullBox() override;
|
||||||
|
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE;
|
bool ReadWrite(BoxBuffer* buffer) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mp4
|
} // namespace mp4
|
||||||
|
|
|
@ -31,10 +31,10 @@ class BoxBuffer;
|
||||||
|
|
||||||
#define DECLARE_BOX_METHODS(T) \
|
#define DECLARE_BOX_METHODS(T) \
|
||||||
T(); \
|
T(); \
|
||||||
virtual ~T(); \
|
~T() override; \
|
||||||
virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE; \
|
bool ReadWrite(BoxBuffer* buffer) override; \
|
||||||
virtual FourCC BoxType() const OVERRIDE; \
|
FourCC BoxType() const override; \
|
||||||
virtual uint32_t ComputeSize() OVERRIDE;
|
uint32_t ComputeSize() override;
|
||||||
|
|
||||||
struct FileType : Box {
|
struct FileType : Box {
|
||||||
DECLARE_BOX_METHODS(FileType);
|
DECLARE_BOX_METHODS(FileType);
|
||||||
|
|
|
@ -30,22 +30,22 @@ static const uint8_t kSkipBox[] = {
|
||||||
0x00};
|
0x00};
|
||||||
|
|
||||||
struct FreeBox : Box {
|
struct FreeBox : Box {
|
||||||
virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE {
|
bool ReadWrite(BoxBuffer* buffer) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual FourCC BoxType() const OVERRIDE { return FOURCC_FREE; }
|
FourCC BoxType() const override { return FOURCC_FREE; }
|
||||||
virtual uint32_t ComputeSize() OVERRIDE {
|
uint32_t ComputeSize() override {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PsshBox : Box {
|
struct PsshBox : Box {
|
||||||
virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE {
|
bool ReadWrite(BoxBuffer* buffer) override {
|
||||||
return buffer->ReadWriteUInt32(&val);
|
return buffer->ReadWriteUInt32(&val);
|
||||||
}
|
}
|
||||||
virtual FourCC BoxType() const OVERRIDE { return FOURCC_PSSH; }
|
FourCC BoxType() const override { return FOURCC_PSSH; }
|
||||||
virtual uint32_t ComputeSize() OVERRIDE {
|
uint32_t ComputeSize() override {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ struct PsshBox : Box {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SkipBox : FullBox {
|
struct SkipBox : FullBox {
|
||||||
virtual bool ReadWrite(BoxBuffer* buffer) OVERRIDE {
|
bool ReadWrite(BoxBuffer* buffer) override {
|
||||||
RCHECK(FullBox::ReadWrite(buffer) && buffer->ReadWriteUInt8(&a) &&
|
RCHECK(FullBox::ReadWrite(buffer) && buffer->ReadWriteUInt8(&a) &&
|
||||||
buffer->ReadWriteUInt8(&b) && buffer->ReadWriteUInt16(&c) &&
|
buffer->ReadWriteUInt8(&b) && buffer->ReadWriteUInt16(&c) &&
|
||||||
buffer->ReadWriteInt32(&d) &&
|
buffer->ReadWriteInt32(&d) &&
|
||||||
|
@ -68,8 +68,8 @@ struct SkipBox : FullBox {
|
||||||
}
|
}
|
||||||
return buffer->TryReadWriteChild(&empty);
|
return buffer->TryReadWriteChild(&empty);
|
||||||
}
|
}
|
||||||
virtual FourCC BoxType() const OVERRIDE { return FOURCC_SKIP; }
|
FourCC BoxType() const override { return FOURCC_SKIP; }
|
||||||
virtual uint32_t ComputeSize() OVERRIDE {
|
uint32_t ComputeSize() override {
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ class EncryptingFragmenter : public Fragmenter {
|
||||||
int64_t clear_time,
|
int64_t clear_time,
|
||||||
uint8_t nalu_length_size);
|
uint8_t nalu_length_size);
|
||||||
|
|
||||||
virtual ~EncryptingFragmenter();
|
~EncryptingFragmenter() override;
|
||||||
|
|
||||||
/// @name Fragmenter implementation overrides.
|
/// @name Fragmenter implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual Status AddSample(scoped_refptr<MediaSample> sample) OVERRIDE;
|
Status AddSample(scoped_refptr<MediaSample> sample) override;
|
||||||
virtual Status InitializeFragment(int64_t first_sample_dts) OVERRIDE;
|
Status InitializeFragment(int64_t first_sample_dts) override;
|
||||||
virtual void FinalizeFragment() OVERRIDE;
|
void FinalizeFragment() override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -43,13 +43,13 @@ class KeyRotationFragmenter : public EncryptingFragmenter {
|
||||||
int64_t clear_time,
|
int64_t clear_time,
|
||||||
uint8_t nalu_length_size,
|
uint8_t nalu_length_size,
|
||||||
MuxerListener* muxer_listener);
|
MuxerListener* muxer_listener);
|
||||||
virtual ~KeyRotationFragmenter();
|
~KeyRotationFragmenter() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// @name Fragmenter implementation overrides.
|
/// @name Fragmenter implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual Status PrepareFragmentForEncryption(bool enable_encryption) OVERRIDE;
|
Status PrepareFragmentForEncryption(bool enable_encryption) override;
|
||||||
virtual void FinalizeFragmentForEncryption() OVERRIDE;
|
void FinalizeFragmentForEncryption() override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -36,15 +36,15 @@ struct ProtectionSystemSpecificHeader;
|
||||||
class MP4MediaParser : public MediaParser {
|
class MP4MediaParser : public MediaParser {
|
||||||
public:
|
public:
|
||||||
MP4MediaParser();
|
MP4MediaParser();
|
||||||
virtual ~MP4MediaParser();
|
~MP4MediaParser() override;
|
||||||
|
|
||||||
/// @name MediaParser implementation overrides.
|
/// @name MediaParser implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual void Init(const InitCB& init_cb,
|
void Init(const InitCB& init_cb,
|
||||||
const NewSampleCB& new_sample_cb,
|
const NewSampleCB& new_sample_cb,
|
||||||
KeySource* decryption_key_source) OVERRIDE;
|
KeySource* decryption_key_source) override;
|
||||||
virtual void Flush() OVERRIDE;
|
void Flush() override;
|
||||||
virtual bool Parse(const uint8_t* buf, int size) OVERRIDE;
|
bool Parse(const uint8_t* buf, int size) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Handles ISO-BMFF containers which have the 'moov' box trailing the
|
/// Handles ISO-BMFF containers which have the 'moov' box trailing the
|
||||||
|
|
|
@ -33,14 +33,14 @@ class MP4Muxer : public Muxer {
|
||||||
public:
|
public:
|
||||||
/// Create a MP4Muxer object from MuxerOptions.
|
/// Create a MP4Muxer object from MuxerOptions.
|
||||||
explicit MP4Muxer(const MuxerOptions& options);
|
explicit MP4Muxer(const MuxerOptions& options);
|
||||||
virtual ~MP4Muxer();
|
~MP4Muxer() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Muxer implementation overrides.
|
// Muxer implementation overrides.
|
||||||
virtual Status Initialize() OVERRIDE;
|
Status Initialize() override;
|
||||||
virtual Status Finalize() OVERRIDE;
|
Status Finalize() override;
|
||||||
virtual Status DoAddSample(const MediaStream* stream,
|
Status DoAddSample(const MediaStream* stream,
|
||||||
scoped_refptr<MediaSample> sample) OVERRIDE;
|
scoped_refptr<MediaSample> sample) override;
|
||||||
|
|
||||||
// Generate Audio/Video Track atom.
|
// Generate Audio/Video Track atom.
|
||||||
void InitializeTrak(const StreamInfo* info, Track* trak);
|
void InitializeTrak(const StreamInfo* info, Track* trak);
|
||||||
|
|
|
@ -33,19 +33,19 @@ class MultiSegmentSegmenter : public Segmenter {
|
||||||
MultiSegmentSegmenter(const MuxerOptions& options,
|
MultiSegmentSegmenter(const MuxerOptions& options,
|
||||||
scoped_ptr<FileType> ftyp,
|
scoped_ptr<FileType> ftyp,
|
||||||
scoped_ptr<Movie> moov);
|
scoped_ptr<Movie> moov);
|
||||||
virtual ~MultiSegmentSegmenter();
|
~MultiSegmentSegmenter() override;
|
||||||
|
|
||||||
/// @name Segmenter implementation overrides.
|
/// @name Segmenter implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool GetInitRange(size_t* offset, size_t* size) OVERRIDE;
|
bool GetInitRange(size_t* offset, size_t* size) override;
|
||||||
virtual bool GetIndexRange(size_t* offset, size_t* size) OVERRIDE;
|
bool GetIndexRange(size_t* offset, size_t* size) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Segmenter implementation overrides.
|
// Segmenter implementation overrides.
|
||||||
virtual Status DoInitialize() OVERRIDE;
|
Status DoInitialize() override;
|
||||||
virtual Status DoFinalize() OVERRIDE;
|
Status DoFinalize() override;
|
||||||
virtual Status DoFinalizeSegment() OVERRIDE;
|
Status DoFinalizeSegment() override;
|
||||||
|
|
||||||
// Write segment to file.
|
// Write segment to file.
|
||||||
Status WriteSegment();
|
Status WriteSegment();
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/strings/stringprintf.h"
|
#include "packager/base/strings/stringprintf.h"
|
||||||
#include "packager/base/threading/platform_thread.h"
|
#include "packager/base/threading/platform_thread.h"
|
||||||
#include "packager/base/time/time.h"
|
#include "packager/base/time/time.h"
|
||||||
|
|
|
@ -30,19 +30,19 @@ class SingleSegmentSegmenter : public Segmenter {
|
||||||
SingleSegmentSegmenter(const MuxerOptions& options,
|
SingleSegmentSegmenter(const MuxerOptions& options,
|
||||||
scoped_ptr<FileType> ftyp,
|
scoped_ptr<FileType> ftyp,
|
||||||
scoped_ptr<Movie> moov);
|
scoped_ptr<Movie> moov);
|
||||||
virtual ~SingleSegmentSegmenter();
|
~SingleSegmentSegmenter() override;
|
||||||
|
|
||||||
/// @name Segmenter implementation overrides.
|
/// @name Segmenter implementation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool GetInitRange(size_t* offset, size_t* size) OVERRIDE;
|
bool GetInitRange(size_t* offset, size_t* size) override;
|
||||||
virtual bool GetIndexRange(size_t* offset, size_t* size) OVERRIDE;
|
bool GetIndexRange(size_t* offset, size_t* size) override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Segmenter implementation overrides.
|
// Segmenter implementation overrides.
|
||||||
virtual Status DoInitialize() OVERRIDE;
|
Status DoInitialize() override;
|
||||||
virtual Status DoFinalize() OVERRIDE;
|
Status DoFinalize() override;
|
||||||
virtual Status DoFinalizeSegment() OVERRIDE;
|
Status DoFinalizeSegment() override;
|
||||||
|
|
||||||
scoped_ptr<SegmentIndex> vod_sidx_;
|
scoped_ptr<SegmentIndex> vod_sidx_;
|
||||||
std::string temp_file_name_;
|
std::string temp_file_name_;
|
||||||
|
|
|
@ -50,16 +50,16 @@ struct PrevSampleData {
|
||||||
class WvmMediaParser : public MediaParser {
|
class WvmMediaParser : public MediaParser {
|
||||||
public:
|
public:
|
||||||
WvmMediaParser();
|
WvmMediaParser();
|
||||||
virtual ~WvmMediaParser();
|
~WvmMediaParser() override;
|
||||||
|
|
||||||
// MediaParser implementation overrides.
|
// MediaParser implementation overrides.
|
||||||
virtual void Init(const InitCB& init_cb,
|
void Init(const InitCB& init_cb,
|
||||||
const NewSampleCB& new_sample_cb,
|
const NewSampleCB& new_sample_cb,
|
||||||
KeySource* decryption_key_source) OVERRIDE;
|
KeySource* decryption_key_source) override;
|
||||||
|
|
||||||
virtual void Flush() OVERRIDE;
|
void Flush() override;
|
||||||
|
|
||||||
virtual bool Parse(const uint8_t* buf, int size) OVERRIDE;
|
bool Parse(const uint8_t* buf, int size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Tag {
|
enum Tag {
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace media {
|
||||||
class MockKeySource : public KeySource {
|
class MockKeySource : public KeySource {
|
||||||
public:
|
public:
|
||||||
MockKeySource() {}
|
MockKeySource() {}
|
||||||
virtual ~MockKeySource() {}
|
~MockKeySource() override {}
|
||||||
|
|
||||||
MOCK_METHOD1(FetchKeys, Status(uint32_t asset_id));
|
MOCK_METHOD1(FetchKeys, Status(uint32_t asset_id));
|
||||||
MOCK_METHOD2(GetKey, Status(TrackType track_type,
|
MOCK_METHOD2(GetKey, Status(TrackType track_type,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/strings/string_number_conversions.h"
|
#include "packager/base/strings/string_number_conversions.h"
|
||||||
#include "packager/base/strings/stringprintf.h"
|
#include "packager/base/strings/stringprintf.h"
|
||||||
#include "packager/base/time/clock.h"
|
#include "packager/base/time/clock.h"
|
||||||
|
@ -80,14 +80,14 @@ MediaStream* FindFirstAudioStream(const std::vector<MediaStream*>& streams) {
|
||||||
class FakeClock : public base::Clock {
|
class FakeClock : public base::Clock {
|
||||||
public:
|
public:
|
||||||
// Fake the clock to return NULL time.
|
// Fake the clock to return NULL time.
|
||||||
virtual base::Time Now() OVERRIDE { return base::Time(); }
|
base::Time Now() override { return base::Time(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackagerTestBasic : public ::testing::TestWithParam<const char*> {
|
class PackagerTestBasic : public ::testing::TestWithParam<const char*> {
|
||||||
public:
|
public:
|
||||||
PackagerTestBasic() {}
|
PackagerTestBasic() {}
|
||||||
|
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
// Create a test directory for testing, will be deleted after test.
|
// Create a test directory for testing, will be deleted after test.
|
||||||
ASSERT_TRUE(base::CreateNewTempDirectory("packager_", &test_directory_));
|
ASSERT_TRUE(base::CreateNewTempDirectory("packager_", &test_directory_));
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class PackagerTestBasic : public ::testing::TestWithParam<const char*> {
|
||||||
test_directory_.AppendASCII(GetParam())));
|
test_directory_.AppendASCII(GetParam())));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() OVERRIDE { base::DeleteFile(test_directory_, true); }
|
void TearDown() override { base::DeleteFile(test_directory_, true); }
|
||||||
|
|
||||||
std::string GetFullPath(const std::string& file_name);
|
std::string GetFullPath(const std::string& file_name);
|
||||||
// Check if |file1| and |file2| are the same.
|
// Check if |file1| and |file2| are the same.
|
||||||
|
@ -271,7 +271,7 @@ TEST_P(PackagerTestBasic, MP4MuxerSingleSegmentEncryptedAudio) {
|
||||||
|
|
||||||
class PackagerTest : public PackagerTestBasic {
|
class PackagerTest : public PackagerTestBasic {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
PackagerTestBasic::SetUp();
|
PackagerTestBasic::SetUp();
|
||||||
|
|
||||||
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
ASSERT_NO_FATAL_FAILURE(Remux(GetParam(),
|
||||||
|
@ -347,9 +347,8 @@ TEST_P(PackagerTest, MP4MuxerMultiSegmentsUnencryptedVideo) {
|
||||||
|
|
||||||
std::string segment_content;
|
std::string segment_content;
|
||||||
ASSERT_TRUE(base::ReadFileToString(segment_path, &segment_content));
|
ASSERT_TRUE(base::ReadFileToString(segment_path, &segment_content));
|
||||||
int bytes_written = file_util::AppendToFile(
|
EXPECT_TRUE(base::AppendToFile(output_path, segment_content.data(),
|
||||||
output_path, segment_content.data(), segment_content.size());
|
segment_content.size()));
|
||||||
ASSERT_EQ(segment_content.size(), static_cast<size_t>(bytes_written));
|
|
||||||
|
|
||||||
++segment_index;
|
++segment_index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ int main(int argc, char **argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
// Needed to enable VLOG/DVLOG through --vmodule or --v.
|
// Needed to enable VLOG/DVLOG through --vmodule or --v.
|
||||||
CommandLine::Init(argc, argv);
|
base::CommandLine::Init(argc, argv);
|
||||||
CHECK(logging::InitLogging(logging::LoggingSettings()));
|
CHECK(logging::InitLogging(logging::LoggingSettings()));
|
||||||
|
|
||||||
base::AtExitManager exit;
|
base::AtExitManager exit;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "packager/media/test/test_data_util.h"
|
#include "packager/media/test/test_data_util.h"
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/logging.h"
|
#include "packager/base/logging.h"
|
||||||
#include "packager/base/path_service.h"
|
#include "packager/base/path_service.h"
|
||||||
|
|
||||||
|
|
|
@ -32,29 +32,27 @@ class DashIopMpdNotifier : public MpdNotifier {
|
||||||
const MpdOptions& mpd_options,
|
const MpdOptions& mpd_options,
|
||||||
const std::vector<std::string>& base_urls,
|
const std::vector<std::string>& base_urls,
|
||||||
const std::string& output_path);
|
const std::string& output_path);
|
||||||
virtual ~DashIopMpdNotifier() OVERRIDE;
|
~DashIopMpdNotifier() override;
|
||||||
|
|
||||||
/// None of the methods write out the MPD file until Flush() is called.
|
/// None of the methods write out the MPD file until Flush() is called.
|
||||||
/// @name MpdNotifier implemetation overrides.
|
/// @name MpdNotifier implemetation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool Init() OVERRIDE;
|
bool Init() override;
|
||||||
virtual bool NotifyNewContainer(const MediaInfo& media_info,
|
bool NotifyNewContainer(const MediaInfo& media_info, uint32_t* id) override;
|
||||||
uint32_t* id) OVERRIDE;
|
bool NotifySampleDuration(uint32_t container_id,
|
||||||
virtual bool NotifySampleDuration(uint32_t container_id,
|
uint32_t sample_duration) override;
|
||||||
uint32_t sample_duration) OVERRIDE;
|
bool NotifyNewSegment(uint32_t id,
|
||||||
virtual bool NotifyNewSegment(uint32_t id,
|
|
||||||
uint64_t start_time,
|
uint64_t start_time,
|
||||||
uint64_t duration,
|
uint64_t duration,
|
||||||
uint64_t size) OVERRIDE;
|
uint64_t size) override;
|
||||||
virtual bool NotifyEncryptionUpdate(
|
bool NotifyEncryptionUpdate(uint32_t container_id,
|
||||||
uint32_t container_id,
|
|
||||||
const std::string& drm_uuid,
|
const std::string& drm_uuid,
|
||||||
const std::vector<uint8_t>& new_key_id,
|
const std::vector<uint8_t>& new_key_id,
|
||||||
const std::vector<uint8_t>& new_pssh) OVERRIDE;
|
const std::vector<uint8_t>& new_pssh) override;
|
||||||
virtual bool AddContentProtectionElement(
|
bool AddContentProtectionElement(
|
||||||
uint32_t id,
|
uint32_t id,
|
||||||
const ContentProtectionElement& content_protection_element) OVERRIDE;
|
const ContentProtectionElement& content_protection_element) override;
|
||||||
virtual bool Flush() OVERRIDE;
|
bool Flush() override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
|
||||||
#include "packager/base/files/file_path.h"
|
#include "packager/base/files/file_path.h"
|
||||||
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
||||||
#include "packager/mpd/base/mock_mpd_builder.h"
|
#include "packager/mpd/base/mock_mpd_builder.h"
|
||||||
#include "packager/mpd/base/mpd_builder.h"
|
#include "packager/mpd/base/mpd_builder.h"
|
||||||
|
@ -101,14 +101,14 @@ class DashIopMpdNotifierTest
|
||||||
default_mock_representation_(
|
default_mock_representation_(
|
||||||
new MockRepresentation(kDefaultRepresentationId)) {}
|
new MockRepresentation(kDefaultRepresentationId)) {}
|
||||||
|
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
||||||
output_path_ = temp_file_path_.value();
|
output_path_ = temp_file_path_.value();
|
||||||
ON_CALL(*default_mock_adaptation_set_, Group())
|
ON_CALL(*default_mock_adaptation_set_, Group())
|
||||||
.WillByDefault(Return(kDefaultGroupId));
|
.WillByDefault(Return(kDefaultGroupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() OVERRIDE {
|
void TearDown() override {
|
||||||
base::DeleteFile(temp_file_path_, false /* non recursive, just 1 file */);
|
base::DeleteFile(temp_file_path_, false /* non recursive, just 1 file */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ TEST_P(DashIopMpdNotifierTest, NotifyNewContainer) {
|
||||||
EXPECT_CALL(*mock_mpd_builder, ToString(_)).WillOnce(Return(true));
|
EXPECT_CALL(*mock_mpd_builder, ToString(_)).WillOnce(Return(true));
|
||||||
|
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&unused_container_id));
|
&unused_container_id));
|
||||||
EXPECT_TRUE(notifier.Flush());
|
EXPECT_TRUE(notifier.Flush());
|
||||||
|
@ -296,7 +296,7 @@ TEST_P(DashIopMpdNotifierTest,
|
||||||
.WillOnce(Return(hd_representation.get()));
|
.WillOnce(Return(hd_representation.get()));
|
||||||
|
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
|
@ -399,7 +399,7 @@ TEST_P(DashIopMpdNotifierTest, NotifyNewContainersWithSameProtectedContent) {
|
||||||
.WillOnce(Return(hd_representation.get()));
|
.WillOnce(Return(hd_representation.get()));
|
||||||
|
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
|
@ -419,7 +419,7 @@ TEST_P(DashIopMpdNotifierTest, AddContentProtection) {
|
||||||
.WillOnce(Return(default_mock_representation_.get()));
|
.WillOnce(Return(default_mock_representation_.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&container_id));
|
&container_id));
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ TEST_P(DashIopMpdNotifierTest, SetGroup) {
|
||||||
// This is not very nice but we need it for settings expectations later.
|
// This is not very nice but we need it for settings expectations later.
|
||||||
MockMpdBuilder* mock_mpd_builder_raw = mock_mpd_builder.get();
|
MockMpdBuilder* mock_mpd_builder_raw = mock_mpd_builder.get();
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
ConvertToMediaInfo(kSdProtectedContent), &unused_container_id));
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
|
@ -664,7 +664,7 @@ TEST_P(DashIopMpdNotifierTest, DoNotSetGroupIfContentTypesDifferent) {
|
||||||
.WillOnce(Return(audio_representation.get()));
|
.WillOnce(Return(audio_representation.get()));
|
||||||
|
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
ConvertToMediaInfo(kVideoContent), &unused_container_id));
|
ConvertToMediaInfo(kVideoContent), &unused_container_id));
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(
|
EXPECT_TRUE(notifier.NotifyNewContainer(
|
||||||
|
@ -704,7 +704,7 @@ TEST_P(DashIopMpdNotifierTest, UpdateEncryption) {
|
||||||
.WillOnce(Return(default_mock_representation_.get()));
|
.WillOnce(Return(default_mock_representation_.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kProtectedContent),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kProtectedContent),
|
||||||
&container_id));
|
&container_id));
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class MockMpdBuilder : public MpdBuilder {
|
||||||
// |type| indicates whether the MPD should be for VOD or live content (kStatic
|
// |type| indicates whether the MPD should be for VOD or live content (kStatic
|
||||||
// for VOD profile, or kDynamic for live profile).
|
// for VOD profile, or kDynamic for live profile).
|
||||||
explicit MockMpdBuilder(MpdType type);
|
explicit MockMpdBuilder(MpdType type);
|
||||||
virtual ~MockMpdBuilder() OVERRIDE;
|
~MockMpdBuilder() override;
|
||||||
|
|
||||||
MOCK_METHOD1(AddAdaptationSet, AdaptationSet*(const std::string& lang));
|
MOCK_METHOD1(AddAdaptationSet, AdaptationSet*(const std::string& lang));
|
||||||
MOCK_METHOD1(ToString, bool(std::string* output));
|
MOCK_METHOD1(ToString, bool(std::string* output));
|
||||||
|
@ -30,7 +30,7 @@ class MockAdaptationSet : public AdaptationSet {
|
||||||
public:
|
public:
|
||||||
// |adaptation_set_id| is the id for the AdaptationSet.
|
// |adaptation_set_id| is the id for the AdaptationSet.
|
||||||
explicit MockAdaptationSet(uint32_t adaptation_set_id);
|
explicit MockAdaptationSet(uint32_t adaptation_set_id);
|
||||||
virtual ~MockAdaptationSet() OVERRIDE;
|
~MockAdaptationSet() override;
|
||||||
|
|
||||||
MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
|
MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
|
||||||
MOCK_METHOD1(AddContentProtectionElement,
|
MOCK_METHOD1(AddContentProtectionElement,
|
||||||
|
@ -51,7 +51,7 @@ class MockRepresentation : public Representation {
|
||||||
public:
|
public:
|
||||||
// |representation_id| is the numeric ID for the <Representation>.
|
// |representation_id| is the numeric ID for the <Representation>.
|
||||||
explicit MockRepresentation(uint32_t representation_id);
|
explicit MockRepresentation(uint32_t representation_id);
|
||||||
virtual ~MockRepresentation() OVERRIDE;
|
~MockRepresentation() override;
|
||||||
|
|
||||||
MOCK_METHOD1(AddContentProtectionElement,
|
MOCK_METHOD1(AddContentProtectionElement,
|
||||||
void(const ContentProtectionElement& element));
|
void(const ContentProtectionElement& element));
|
||||||
|
|
|
@ -353,17 +353,17 @@ class RepresentationStateChangeListenerImpl
|
||||||
: representation_id_(representation_id), adaptation_set_(adaptation_set) {
|
: representation_id_(representation_id), adaptation_set_(adaptation_set) {
|
||||||
DCHECK(adaptation_set_);
|
DCHECK(adaptation_set_);
|
||||||
}
|
}
|
||||||
virtual ~RepresentationStateChangeListenerImpl() OVERRIDE {}
|
~RepresentationStateChangeListenerImpl() override {}
|
||||||
|
|
||||||
// RepresentationStateChangeListener implementation.
|
// RepresentationStateChangeListener implementation.
|
||||||
virtual void OnNewSegmentForRepresentation(uint64_t start_time,
|
void OnNewSegmentForRepresentation(uint64_t start_time,
|
||||||
uint64_t duration) OVERRIDE {
|
uint64_t duration) override {
|
||||||
adaptation_set_->OnNewSegmentForRepresentation(representation_id_,
|
adaptation_set_->OnNewSegmentForRepresentation(representation_id_,
|
||||||
start_time, duration);
|
start_time, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration,
|
void OnSetFrameRateForRepresentation(uint32_t frame_duration,
|
||||||
uint32_t timescale) OVERRIDE {
|
uint32_t timescale) override {
|
||||||
adaptation_set_->OnSetFrameRateForRepresentation(representation_id_,
|
adaptation_set_->OnSetFrameRateForRepresentation(representation_id_,
|
||||||
frame_duration, timescale);
|
frame_duration, timescale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <libxml/xmlstring.h>
|
#include <libxml/xmlstring.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/strings/string_piece.h"
|
||||||
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/logging.h"
|
#include "packager/base/logging.h"
|
||||||
#include "packager/base/strings/string_number_conversions.h"
|
#include "packager/base/strings/string_number_conversions.h"
|
||||||
#include "packager/base/strings/string_piece.h"
|
#include "packager/base/strings/string_piece.h"
|
||||||
|
@ -97,7 +98,7 @@ template <MpdBuilder::MpdType type>
|
||||||
class MpdBuilderTest: public ::testing::Test {
|
class MpdBuilderTest: public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
MpdBuilderTest() : mpd_(type, MpdOptions()), representation_() {}
|
MpdBuilderTest() : mpd_(type, MpdOptions()), representation_() {}
|
||||||
virtual ~MpdBuilderTest() {}
|
~MpdBuilderTest() override {}
|
||||||
|
|
||||||
void CheckMpd(const std::string& expected_output_file) {
|
void CheckMpd(const std::string& expected_output_file) {
|
||||||
std::string mpd_doc;
|
std::string mpd_doc;
|
||||||
|
@ -143,11 +144,11 @@ typedef StaticMpdBuilderTest CommonMpdBuilderTest;
|
||||||
|
|
||||||
class DynamicMpdBuilderTest : public MpdBuilderTest<MpdBuilder::kDynamic> {
|
class DynamicMpdBuilderTest : public MpdBuilderTest<MpdBuilder::kDynamic> {
|
||||||
public:
|
public:
|
||||||
virtual ~DynamicMpdBuilderTest() {}
|
~DynamicMpdBuilderTest() override {}
|
||||||
|
|
||||||
// Anchors availabilityStartTime so that the test result doesn't depend on the
|
// Anchors availabilityStartTime so that the test result doesn't depend on the
|
||||||
// current time.
|
// current time.
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
mpd_.availability_start_time_ = "2011-12-25T12:30:00";
|
mpd_.availability_start_time_ = "2011-12-25T12:30:00";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,9 +181,9 @@ class SegmentTemplateTest : public DynamicMpdBuilderTest {
|
||||||
public:
|
public:
|
||||||
SegmentTemplateTest()
|
SegmentTemplateTest()
|
||||||
: bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks) {}
|
: bandwidth_estimator_(BandwidthEstimator::kUseAllBlocks) {}
|
||||||
virtual ~SegmentTemplateTest() {}
|
~SegmentTemplateTest() override {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
DynamicMpdBuilderTest::SetUp();
|
DynamicMpdBuilderTest::SetUp();
|
||||||
ASSERT_NO_FATAL_FAILURE(AddRepresentationWithDefaultMediaInfo());
|
ASSERT_NO_FATAL_FAILURE(AddRepresentationWithDefaultMediaInfo());
|
||||||
}
|
}
|
||||||
|
@ -270,12 +271,12 @@ class SegmentTemplateTest : public DynamicMpdBuilderTest {
|
||||||
class TimeShiftBufferDepthTest : public SegmentTemplateTest {
|
class TimeShiftBufferDepthTest : public SegmentTemplateTest {
|
||||||
public:
|
public:
|
||||||
TimeShiftBufferDepthTest() {}
|
TimeShiftBufferDepthTest() {}
|
||||||
virtual ~TimeShiftBufferDepthTest() {}
|
~TimeShiftBufferDepthTest() override {}
|
||||||
|
|
||||||
// This function is tricky. It does not call SegmentTemplateTest::Setup() so
|
// This function is tricky. It does not call SegmentTemplateTest::Setup() so
|
||||||
// that it does not automatically add a representation, that has $Time$
|
// that it does not automatically add a representation, that has $Time$
|
||||||
// template.
|
// template.
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
DynamicMpdBuilderTest::SetUp();
|
DynamicMpdBuilderTest::SetUp();
|
||||||
|
|
||||||
// The only diff with current GetDefaultMediaInfo() is that this uses
|
// The only diff with current GetDefaultMediaInfo() is that this uses
|
||||||
|
@ -458,9 +459,9 @@ TEST_F(CommonMpdBuilderTest,
|
||||||
new MockRepresentationStateChangeListener());
|
new MockRepresentationStateChangeListener());
|
||||||
EXPECT_CALL(*listener,
|
EXPECT_CALL(*listener,
|
||||||
OnNewSegmentForRepresentation(kStartTime, kDuration));
|
OnNewSegmentForRepresentation(kStartTime, kDuration));
|
||||||
Representation representation(
|
Representation representation(ConvertToMediaInfo(kTestMediaInfo),
|
||||||
ConvertToMediaInfo(kTestMediaInfo), MpdOptions(), kAnyRepresentationId,
|
MpdOptions(), kAnyRepresentationId,
|
||||||
listener.PassAs<RepresentationStateChangeListener>());
|
listener.Pass());
|
||||||
EXPECT_TRUE(representation.Init());
|
EXPECT_TRUE(representation.Init());
|
||||||
|
|
||||||
representation.AddNewSegment(kStartTime, kDuration, 10 /* any size */);
|
representation.AddNewSegment(kStartTime, kDuration, 10 /* any size */);
|
||||||
|
@ -489,9 +490,9 @@ TEST_F(CommonMpdBuilderTest,
|
||||||
new MockRepresentationStateChangeListener());
|
new MockRepresentationStateChangeListener());
|
||||||
EXPECT_CALL(*listener,
|
EXPECT_CALL(*listener,
|
||||||
OnSetFrameRateForRepresentation(kFrameDuration, kTimeScale));
|
OnSetFrameRateForRepresentation(kFrameDuration, kTimeScale));
|
||||||
Representation representation(
|
Representation representation(ConvertToMediaInfo(kTestMediaInfo),
|
||||||
ConvertToMediaInfo(kTestMediaInfo), MpdOptions(), kAnyRepresentationId,
|
MpdOptions(), kAnyRepresentationId,
|
||||||
listener.PassAs<RepresentationStateChangeListener>());
|
listener.Pass());
|
||||||
EXPECT_TRUE(representation.Init());
|
EXPECT_TRUE(representation.Init());
|
||||||
|
|
||||||
representation.SetSampleDuration(kFrameDuration);
|
representation.SetSampleDuration(kFrameDuration);
|
||||||
|
|
|
@ -105,7 +105,7 @@ bool HexToUUID(const std::string& data, std::string* uuid_format) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string hex_encoded =
|
const std::string hex_encoded =
|
||||||
StringToLowerASCII(base::HexEncode(data.data(), data.size()));
|
base::StringToLowerASCII(base::HexEncode(data.data(), data.size()));
|
||||||
DCHECK_EQ(hex_encoded.size(), kExpectedUUIDSize * 2);
|
DCHECK_EQ(hex_encoded.size(), kExpectedUUIDSize * 2);
|
||||||
base::StringPiece all(hex_encoded);
|
base::StringPiece all(hex_encoded);
|
||||||
// Note UUID has 5 parts separated with dashes.
|
// Note UUID has 5 parts separated with dashes.
|
||||||
|
|
|
@ -34,28 +34,26 @@ class SimpleMpdNotifier : public MpdNotifier {
|
||||||
const MpdOptions& mpd_options,
|
const MpdOptions& mpd_options,
|
||||||
const std::vector<std::string>& base_urls,
|
const std::vector<std::string>& base_urls,
|
||||||
const std::string& output_path);
|
const std::string& output_path);
|
||||||
virtual ~SimpleMpdNotifier();
|
~SimpleMpdNotifier() override;
|
||||||
|
|
||||||
/// @name MpdNotifier implemetation overrides.
|
/// @name MpdNotifier implemetation overrides.
|
||||||
/// @{
|
/// @{
|
||||||
virtual bool Init() OVERRIDE;
|
bool Init() override;
|
||||||
virtual bool NotifyNewContainer(const MediaInfo& media_info,
|
bool NotifyNewContainer(const MediaInfo& media_info, uint32_t* id) override;
|
||||||
uint32_t* id) OVERRIDE;
|
bool NotifySampleDuration(uint32_t container_id,
|
||||||
virtual bool NotifySampleDuration(uint32_t container_id,
|
uint32_t sample_duration) override;
|
||||||
uint32_t sample_duration) OVERRIDE;
|
bool NotifyNewSegment(uint32_t id,
|
||||||
virtual bool NotifyNewSegment(uint32_t id,
|
|
||||||
uint64_t start_time,
|
uint64_t start_time,
|
||||||
uint64_t duration,
|
uint64_t duration,
|
||||||
uint64_t size) OVERRIDE;
|
uint64_t size) override;
|
||||||
virtual bool NotifyEncryptionUpdate(
|
bool NotifyEncryptionUpdate(uint32_t container_id,
|
||||||
uint32_t container_id,
|
|
||||||
const std::string& drm_uuid,
|
const std::string& drm_uuid,
|
||||||
const std::vector<uint8_t>& new_key_id,
|
const std::vector<uint8_t>& new_key_id,
|
||||||
const std::vector<uint8_t>& new_pssh) OVERRIDE;
|
const std::vector<uint8_t>& new_pssh) override;
|
||||||
virtual bool AddContentProtectionElement(
|
bool AddContentProtectionElement(
|
||||||
uint32_t id,
|
uint32_t id,
|
||||||
const ContentProtectionElement& content_protection_element) OVERRIDE;
|
const ContentProtectionElement& content_protection_element) override;
|
||||||
virtual bool Flush() OVERRIDE;
|
bool Flush() override;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
|
||||||
#include "packager/base/files/file_path.h"
|
#include "packager/base/files/file_path.h"
|
||||||
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/mpd/base/mock_mpd_builder.h"
|
#include "packager/mpd/base/mock_mpd_builder.h"
|
||||||
#include "packager/mpd/base/mpd_builder.h"
|
#include "packager/mpd/base/mpd_builder.h"
|
||||||
#include "packager/mpd/base/mpd_options.h"
|
#include "packager/mpd/base/mpd_options.h"
|
||||||
|
@ -42,12 +42,12 @@ class SimpleMpdNotifierTest
|
||||||
: default_mock_adaptation_set_(
|
: default_mock_adaptation_set_(
|
||||||
new MockAdaptationSet(kDefaultAdaptationSetId)) {}
|
new MockAdaptationSet(kDefaultAdaptationSetId)) {}
|
||||||
|
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_));
|
||||||
output_path_ = temp_file_path_.value();
|
output_path_ = temp_file_path_.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() OVERRIDE {
|
void TearDown() override {
|
||||||
base::DeleteFile(temp_file_path_, false /* non recursive, just 1 file */);
|
base::DeleteFile(temp_file_path_, false /* non recursive, just 1 file */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ TEST_P(SimpleMpdNotifierTest, NotifyNewContainer) {
|
||||||
EXPECT_CALL(*mock_mpd_builder, ToString(_)).WillOnce(Return(true));
|
EXPECT_CALL(*mock_mpd_builder, ToString(_)).WillOnce(Return(true));
|
||||||
|
|
||||||
uint32_t unused_container_id;
|
uint32_t unused_container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&unused_container_id));
|
&unused_container_id));
|
||||||
EXPECT_TRUE(notifier.Flush());
|
EXPECT_TRUE(notifier.Flush());
|
||||||
|
@ -138,7 +138,7 @@ TEST_F(SimpleMpdNotifierTest, LiveNotifySampleDuration) {
|
||||||
.WillOnce(Return(mock_representation.get()));
|
.WillOnce(Return(mock_representation.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&container_id));
|
&container_id));
|
||||||
EXPECT_EQ(kRepresentationId, container_id);
|
EXPECT_EQ(kRepresentationId, container_id);
|
||||||
|
@ -169,7 +169,7 @@ TEST_F(SimpleMpdNotifierTest, OnDemandNotifySampleDuration) {
|
||||||
.WillOnce(Return(mock_representation.get()));
|
.WillOnce(Return(mock_representation.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&container_id));
|
&container_id));
|
||||||
EXPECT_EQ(kRepresentationId, container_id);
|
EXPECT_EQ(kRepresentationId, container_id);
|
||||||
|
@ -196,7 +196,7 @@ TEST_F(SimpleMpdNotifierTest, LiveNotifyNewSegment) {
|
||||||
.WillOnce(Return(mock_representation.get()));
|
.WillOnce(Return(mock_representation.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&container_id));
|
&container_id));
|
||||||
EXPECT_EQ(kRepresentationId, container_id);
|
EXPECT_EQ(kRepresentationId, container_id);
|
||||||
|
@ -227,7 +227,7 @@ TEST_F(SimpleMpdNotifierTest, AddContentProtectionElement) {
|
||||||
.WillOnce(Return(mock_representation.get()));
|
.WillOnce(Return(mock_representation.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kValidMediaInfo),
|
||||||
&container_id));
|
&container_id));
|
||||||
EXPECT_EQ(kRepresentationId, container_id);
|
EXPECT_EQ(kRepresentationId, container_id);
|
||||||
|
@ -270,7 +270,7 @@ TEST_P(SimpleMpdNotifierTest, UpdateEncryption) {
|
||||||
.WillOnce(Return(mock_representation.get()));
|
.WillOnce(Return(mock_representation.get()));
|
||||||
|
|
||||||
uint32_t container_id;
|
uint32_t container_id;
|
||||||
SetMpdBuilder(¬ifier, mock_mpd_builder.PassAs<MpdBuilder>());
|
SetMpdBuilder(¬ifier, mock_mpd_builder.Pass());
|
||||||
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kProtectedContent),
|
EXPECT_TRUE(notifier.NotifyNewContainer(ConvertToMediaInfo(kProtectedContent),
|
||||||
&container_id));
|
&container_id));
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class XmlNode {
|
||||||
/// AdaptationSet and Representation are subtypes of this.
|
/// AdaptationSet and Representation are subtypes of this.
|
||||||
class RepresentationBaseXmlNode : public XmlNode {
|
class RepresentationBaseXmlNode : public XmlNode {
|
||||||
public:
|
public:
|
||||||
virtual ~RepresentationBaseXmlNode();
|
~RepresentationBaseXmlNode() override;
|
||||||
bool AddContentProtectionElements(
|
bool AddContentProtectionElements(
|
||||||
const std::list<ContentProtectionElement>& content_protection_elements);
|
const std::list<ContentProtectionElement>& content_protection_elements);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class RepresentationBaseXmlNode : public XmlNode {
|
||||||
class AdaptationSetXmlNode : public RepresentationBaseXmlNode {
|
class AdaptationSetXmlNode : public RepresentationBaseXmlNode {
|
||||||
public:
|
public:
|
||||||
AdaptationSetXmlNode();
|
AdaptationSetXmlNode();
|
||||||
virtual ~AdaptationSetXmlNode();
|
~AdaptationSetXmlNode() override;
|
||||||
|
|
||||||
/// @param scheme_id_uri is content of the schemeIdUri attribute.
|
/// @param scheme_id_uri is content of the schemeIdUri attribute.
|
||||||
/// @param value is the content of value attribute.
|
/// @param value is the content of value attribute.
|
||||||
|
@ -128,7 +128,7 @@ class AdaptationSetXmlNode : public RepresentationBaseXmlNode {
|
||||||
class RepresentationXmlNode : public RepresentationBaseXmlNode {
|
class RepresentationXmlNode : public RepresentationBaseXmlNode {
|
||||||
public:
|
public:
|
||||||
RepresentationXmlNode();
|
RepresentationXmlNode();
|
||||||
virtual ~RepresentationXmlNode();
|
~RepresentationXmlNode() override;
|
||||||
|
|
||||||
/// Adds video metadata to the MPD.
|
/// Adds video metadata to the MPD.
|
||||||
/// @param video_info constains the VideoInfo for a Representation.
|
/// @param video_info constains the VideoInfo for a Representation.
|
||||||
|
|
|
@ -55,7 +55,7 @@ ScopedXmlPtr<xmlDoc>::type MakeDoc(ScopedXmlPtr<xmlNode>::type node) {
|
||||||
class RepresentationTest : public ::testing::Test {
|
class RepresentationTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
RepresentationTest() {}
|
RepresentationTest() {}
|
||||||
virtual ~RepresentationTest() {}
|
~RepresentationTest() override {}
|
||||||
|
|
||||||
// Ownership transfers, IOW this function will release the resource for
|
// Ownership transfers, IOW this function will release the resource for
|
||||||
// |node|. Returns |node| in string format.
|
// |node|. Returns |node| in string format.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/path_service.h"
|
#include "packager/base/path_service.h"
|
||||||
#include "packager/mpd/base/media_info.pb.h"
|
#include "packager/mpd/base/media_info.pb.h"
|
||||||
#include "packager/mpd/base/mpd_builder.h"
|
#include "packager/mpd/base/mpd_builder.h"
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
|
||||||
#include "packager/base/files/file_path.h"
|
#include "packager/base/files/file_path.h"
|
||||||
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/media/file/file.h"
|
#include "packager/media/file/file.h"
|
||||||
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
||||||
#include "packager/mpd/base/mpd_builder.h"
|
#include "packager/mpd/base/mpd_builder.h"
|
||||||
|
@ -35,13 +35,12 @@ namespace {
|
||||||
class DashIopMpdNotifierFactory : public MpdNotifierFactory {
|
class DashIopMpdNotifierFactory : public MpdNotifierFactory {
|
||||||
public:
|
public:
|
||||||
DashIopMpdNotifierFactory() {}
|
DashIopMpdNotifierFactory() {}
|
||||||
virtual ~DashIopMpdNotifierFactory() OVERRIDE {}
|
~DashIopMpdNotifierFactory() override {}
|
||||||
|
|
||||||
virtual scoped_ptr<MpdNotifier> Create(
|
scoped_ptr<MpdNotifier> Create(DashProfile dash_profile,
|
||||||
DashProfile dash_profile,
|
|
||||||
const MpdOptions& mpd_options,
|
const MpdOptions& mpd_options,
|
||||||
const std::vector<std::string>& base_urls,
|
const std::vector<std::string>& base_urls,
|
||||||
const std::string& output_path) OVERRIDE {
|
const std::string& output_path) override {
|
||||||
return scoped_ptr<MpdNotifier>(new DashIopMpdNotifier(
|
return scoped_ptr<MpdNotifier>(new DashIopMpdNotifier(
|
||||||
dash_profile, mpd_options, base_urls, output_path));
|
dash_profile, mpd_options, base_urls, output_path));
|
||||||
}
|
}
|
||||||
|
@ -51,13 +50,12 @@ class DashIopMpdNotifierFactory : public MpdNotifierFactory {
|
||||||
class SimpleMpdNotifierFactory : public MpdNotifierFactory {
|
class SimpleMpdNotifierFactory : public MpdNotifierFactory {
|
||||||
public:
|
public:
|
||||||
SimpleMpdNotifierFactory() {}
|
SimpleMpdNotifierFactory() {}
|
||||||
virtual ~SimpleMpdNotifierFactory() OVERRIDE {}
|
~SimpleMpdNotifierFactory() override {}
|
||||||
|
|
||||||
virtual scoped_ptr<MpdNotifier> Create(
|
scoped_ptr<MpdNotifier> Create(DashProfile dash_profile,
|
||||||
DashProfile dash_profile,
|
|
||||||
const MpdOptions& mpd_options,
|
const MpdOptions& mpd_options,
|
||||||
const std::vector<std::string>& base_urls,
|
const std::vector<std::string>& base_urls,
|
||||||
const std::string& output_path) OVERRIDE {
|
const std::string& output_path) override {
|
||||||
return scoped_ptr<MpdNotifier>(new SimpleMpdNotifier(
|
return scoped_ptr<MpdNotifier>(new SimpleMpdNotifier(
|
||||||
dash_profile, mpd_options, base_urls, output_path));
|
dash_profile, mpd_options, base_urls, output_path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "packager/base/file_util.h"
|
#include "packager/base/files/file_util.h"
|
||||||
#include "packager/base/path_service.h"
|
#include "packager/base/path_service.h"
|
||||||
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
#include "packager/mpd/base/dash_iop_mpd_notifier.h"
|
||||||
#include "packager/mpd/base/mock_mpd_notifier.h"
|
#include "packager/mpd/base/mock_mpd_notifier.h"
|
||||||
|
@ -26,18 +26,17 @@ namespace {
|
||||||
class TestMpdNotifierFactory : public MpdNotifierFactory {
|
class TestMpdNotifierFactory : public MpdNotifierFactory {
|
||||||
public:
|
public:
|
||||||
TestMpdNotifierFactory() {}
|
TestMpdNotifierFactory() {}
|
||||||
virtual ~TestMpdNotifierFactory() OVERRIDE {}
|
~TestMpdNotifierFactory() override {}
|
||||||
|
|
||||||
// So sad that this method cannot be mocked (gmock errors at compile time).
|
// So sad that this method cannot be mocked (gmock errors at compile time).
|
||||||
// Also (probably) this version of gmock does not support returning
|
// Also (probably) this version of gmock does not support returning
|
||||||
// scoped_ptr.
|
// scoped_ptr.
|
||||||
// For now we only need to return MockMpdNotifier() with these set of
|
// For now we only need to return MockMpdNotifier() with these set of
|
||||||
// expectations for all the tests.
|
// expectations for all the tests.
|
||||||
virtual scoped_ptr<MpdNotifier> Create(
|
scoped_ptr<MpdNotifier> Create(DashProfile dash_profile,
|
||||||
DashProfile dash_profile,
|
|
||||||
const MpdOptions& mpd_options,
|
const MpdOptions& mpd_options,
|
||||||
const std::vector<std::string>& base_urls,
|
const std::vector<std::string>& base_urls,
|
||||||
const std::string& output_path) OVERRIDE {
|
const std::string& output_path) override {
|
||||||
EXPECT_EQ(expected_base_urls_, base_urls);
|
EXPECT_EQ(expected_base_urls_, base_urls);
|
||||||
|
|
||||||
scoped_ptr<MockMpdNotifier> mock_notifier(
|
scoped_ptr<MockMpdNotifier> mock_notifier(
|
||||||
|
@ -48,7 +47,7 @@ class TestMpdNotifierFactory : public MpdNotifierFactory {
|
||||||
.Times(2)
|
.Times(2)
|
||||||
.WillRepeatedly(Return(true));
|
.WillRepeatedly(Return(true));
|
||||||
EXPECT_CALL(*mock_notifier, Flush()).WillOnce(Return(true));
|
EXPECT_CALL(*mock_notifier, Flush()).WillOnce(Return(true));
|
||||||
return mock_notifier.PassAs<MpdNotifier>();
|
return mock_notifier.Pass();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetExpectedBaseUrls(const std::vector<std::string>& base_urls) {
|
void SetExpectedBaseUrls(const std::vector<std::string>& base_urls) {
|
||||||
|
@ -64,13 +63,12 @@ class MpdWriterTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
// Note that MpdWriter::SetMpdNotifierFactoryForTest() is not called in SetUp.
|
// Note that MpdWriter::SetMpdNotifierFactoryForTest() is not called in SetUp.
|
||||||
// Set expectations in the test and call it.
|
// Set expectations in the test and call it.
|
||||||
virtual void SetUp() OVERRIDE {
|
void SetUp() override {
|
||||||
notifier_factory_.reset(new TestMpdNotifierFactory());
|
notifier_factory_.reset(new TestMpdNotifierFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMpdNotifierFactoryForTest() {
|
void SetMpdNotifierFactoryForTest() {
|
||||||
mpd_writer_.SetMpdNotifierFactoryForTest(
|
mpd_writer_.SetMpdNotifierFactoryForTest(notifier_factory_.Pass());
|
||||||
notifier_factory_.PassAs<MpdNotifierFactory>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<TestMpdNotifierFactory> notifier_factory_;
|
scoped_ptr<TestMpdNotifierFactory> notifier_factory_;
|
||||||
|
|
Loading…
Reference in New Issue