Commit 82c38ab5 authored by halliwell's avatar halliwell Committed by Commit bot

Initialize Cast Media for cast_media_unittests

This allows removal of the lazy initialisation workaround recently
added to vendor media implementation.

BUG=

Review URL: https://codereview.chromium.org/1137183003

Cr-Commit-Position: refs/heads/master@{#330136}
parent c4e3f83f
......@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
......@@ -28,6 +29,7 @@
#include "chromecast/media/cma/base/decoder_config_adapter.h"
#include "chromecast/media/cma/test/frame_segmenter_for_test.h"
#include "chromecast/media/cma/test/media_component_device_feeder_for_test.h"
#include "chromecast/public/cast_media_shlib.h"
#include "chromecast/public/media/decoder_config.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/buffers.h"
......@@ -71,6 +73,15 @@ class AudioVideoPipelineDeviceTest : public testing::Test {
AudioVideoPipelineDeviceTest();
~AudioVideoPipelineDeviceTest() override;
void SetUp() override {
CastMediaShlib::Initialize(
base::CommandLine::ForCurrentProcess()->argv());
}
void TearDown() override {
CastMediaShlib::Finalize();
}
void ConfigureForFile(std::string filename);
void ConfigureForAudioOnly(std::string filename);
void ConfigureForVideoOnly(std::string filename, bool raw_h264);
......
......@@ -13,15 +13,24 @@
namespace chromecast {
namespace media {
// Provides access to platform-specific media systems and hardware resources.
// In cast_shell, all usage is from the browser process. An implementation is
// assumed to be in an uninitialized state initially. When uninitialized, no
// API calls will be made except for Initialize, which brings the implementation
// into an initialized state. A call to Finalize returns the implementation to
// its uninitialized state. The implementation must support multiple
// transitions between these states, to support resource grant/revoke events and
// also to allow multiple unit tests to bring up the media systems in isolation
// from other tests.
class CHROMECAST_EXPORT CastMediaShlib {
public:
// Performs platform-specific one-time initialization for media systems and
// hardware resources. Called at startup in browser process before main
// message loop begins.
// Initializes platform-specific media systems. Only called when in an
// uninitialized state.
static void Initialize(const std::vector<std::string>& argv);
// Performs platform-specific one-time teardown of media systems and hardware
// resources. Called at browser process exit.
// Tears down platform-specific media systems and returns to the uninitialized
// state. The implementation must release all media-related hardware
// resources.
static void Finalize();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment