Chromium Code Reviews| Index: content/common/gpu/media/video_decode_accelerator_unittest.cc |
| =================================================================== |
| --- content/common/gpu/media/video_decode_accelerator_unittest.cc (revision 114547) |
| +++ content/common/gpu/media/video_decode_accelerator_unittest.cc (working copy) |
| @@ -28,6 +28,7 @@ |
| #include "base/bind.h" |
| #include "base/command_line.h" |
| #include "base/file_util.h" |
| +#include "base/process_util.h" |
| #include "base/stl_util.h" |
| #include "base/string_number_conversions.h" |
| #include "base/string_split.h" |
| @@ -36,14 +37,21 @@ |
| #include "base/synchronization/lock.h" |
| #include "base/synchronization/waitable_event.h" |
| #include "base/threading/thread.h" |
| +#include "base/utf_string_conversions.h" |
| + |
| +#if (!defined(OS_CHROMEOS) || !defined(ARCH_CPU_ARMEL)) && !defined(OS_WIN) |
| +#error The VideoAccelerator tests are only supported on cros/ARM/Windows. |
| +#endif |
| + |
| +#if defined(OS_WIN) |
| +#include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| +#else // OS_WIN |
| #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
| +#endif // defined(OS_WIN) |
| + |
| #include "third_party/angle/include/EGL/egl.h" |
| #include "third_party/angle/include/GLES2/gl2.h" |
| -#if !defined(OS_CHROMEOS) || !defined(ARCH_CPU_ARMEL) |
| -#error This test (and OmxVideoDecodeAccelerator) are only supported on cros/ARM! |
| -#endif |
| - |
| using media::VideoDecodeAccelerator; |
| namespace { |
| @@ -61,20 +69,21 @@ |
| // (the latter tests just decode speed). |
| // - |profile| is the media::H264Profile set during Initialization. |
| // An empty value for a numeric field means "ignore". |
| -const char* test_video_data = "test-25fps.h264:320:240:250:258:50:175:1"; |
| +const FilePath::CharType* test_video_data = |
| + FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); |
| // Parse |data| into its constituent parts and set the various output fields |
| // accordingly. CHECK-fails on unexpected or missing required data. |
| // Unspecified optional fields are set to -1. |
| -void ParseTestVideoData(std::string data, |
| - std::string* file_name, |
| +void ParseTestVideoData(FilePath::StringType data, |
| + FilePath::StringType* file_name, |
| int* width, int* height, |
| int* num_frames, |
| int* num_NALUs, |
| int* min_fps_render, |
| int* min_fps_no_render, |
| int* profile) { |
| - std::vector<std::string> elements; |
| + std::vector<FilePath::StringType> elements; |
| base::SplitString(data, ':', &elements); |
| CHECK_GE(elements.size(), 1U) << data; |
| CHECK_LE(elements.size(), 8U) << data; |
| @@ -98,18 +107,13 @@ |
| CHECK(base::StringToInt(elements[7], profile)); |
| } |
| - |
| -// Helper for managing X11, EGL, and GLES2 resources. Xlib is not thread-safe, |
| -// and GL state is thread-specific, so all the methods of this class (except for |
| -// ctor/dtor) ensure they're being run on a single thread. |
| -// |
| -// TODO(fischman): consider moving this into media/ if we can de-dup some of the |
| -// code that ends up getting copy/pasted all over the place (esp. the GL setup |
| -// code). |
| -class RenderingHelper { |
| +// Provides base functionality for managing EGL and GLES2 resources. |
| +// This class is not thread safe and thus all the methods of this class |
| +// (except for ctor/dtor) ensure they're being run on a single thread. |
| +class RenderingHelperBase { |
| public: |
| - explicit RenderingHelper(); |
| - ~RenderingHelper(); |
| + RenderingHelperBase(); |
| + virtual ~RenderingHelperBase(); |
| // Initialize all structures to prepare to render to one or more windows of |
| // the specified dimensions. CHECK-fails if any initialization step fails. |
| @@ -119,8 +123,8 @@ |
| // then all the usual work is done, except for the final swap of the EGL |
| // surface to the display. This cuts test times over 50% so is worth doing |
| // when testing non-rendering-related aspects. |
| - void Initialize(bool suppress_swap_to_display, int num_windows, |
| - int width, int height, base::WaitableEvent* done); |
| + void Initialize(bool suppress_swap_to_display, int num_windows, int width, |
| + int height, base::WaitableEvent* done); |
| // Undo the effects of Initialize() and signal |*done|. |
| void UnInitialize(base::WaitableEvent* done); |
| @@ -136,49 +140,48 @@ |
| // Delete |texture_id|. |
| void DeleteTexture(GLuint texture_id); |
| + // Platform specific Init/Uninit. |
| + virtual void PlatformInitialize() = 0; |
| + virtual void PlatformUnInitialize() = 0; |
| + |
| + // Platform specific window creation. |
| + virtual EGLNativeWindowType PlatformCreateWindow(int top_left_x, |
| + int top_left_y) = 0; |
| + |
| + // Platform specific display surface returned here. |
| + virtual EGLDisplay PlatformGetDisplay() = 0; |
| + |
| EGLDisplay egl_display() { return egl_display_; } |
| + |
| EGLContext egl_context() { return egl_context_; } |
| + |
| MessageLoop* message_loop() { return message_loop_; } |
| - private: |
| - // Zero-out internal state. Helper for ctor & UnInitialize(). |
| + protected: |
| void Clear(); |
| - bool suppress_swap_to_display_; |
| + // We ensure all operations are carried out on the same thread by remembering |
| + // where we were Initialized. |
| + MessageLoop* message_loop_; |
| int width_; |
| int height_; |
| - Display* x_display_; |
| - std::vector<Window> x_windows_; |
| + bool suppress_swap_to_display_; |
| + |
| EGLDisplay egl_display_; |
| EGLContext egl_context_; |
| std::vector<EGLSurface> egl_surfaces_; |
| std::map<GLuint, int> texture_id_to_surface_index_; |
| - // We ensure all operations are carried out on the same thread by remembering |
| - // where we were Initialized. |
| - MessageLoop* message_loop_; |
| }; |
| -RenderingHelper::RenderingHelper() { |
| +RenderingHelperBase::RenderingHelperBase() { |
| Clear(); |
| } |
| -RenderingHelper::~RenderingHelper() { |
| +RenderingHelperBase::~RenderingHelperBase() { |
| CHECK_EQ(width_, 0) << "Must call UnInitialize before dtor."; |
| + Clear(); |
| } |
| -void RenderingHelper::Clear() { |
| - suppress_swap_to_display_ = false; |
| - width_ = 0; |
| - height_ = 0; |
| - x_display_ = NULL; |
| - x_windows_.clear(); |
| - egl_display_ = EGL_NO_DISPLAY; |
| - egl_context_ = EGL_NO_CONTEXT; |
| - egl_surfaces_.clear(); |
| - texture_id_to_surface_index_.clear(); |
| - message_loop_ = NULL; |
| -} |
| - |
| // Helper for Shader creation. |
| static void CreateShader( |
| GLuint program, GLenum type, const char* source, int size) { |
| @@ -197,11 +200,11 @@ |
| CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| } |
| -void RenderingHelper::Initialize( |
| - bool suppress_swap_to_display, |
| - int num_windows, |
| - int width, int height, |
| - base::WaitableEvent* done) { |
| +void RenderingHelperBase::Initialize(bool suppress_swap_to_display, |
| + int num_windows, |
| + int width, |
| + int height, |
| + base::WaitableEvent* done) { |
| // Use width_ != 0 as a proxy for the class having already been |
| // Initialize()'d, and UnInitialize() before continuing. |
| if (width_) { |
| @@ -218,15 +221,10 @@ |
| message_loop_ = MessageLoop::current(); |
| CHECK_GT(num_windows, 0); |
| - // Per-display X11 & EGL initialization. |
| - CHECK(x_display_ = XOpenDisplay(NULL)); |
| - int depth = DefaultDepth(x_display_, DefaultScreen(x_display_)); |
| - XSetWindowAttributes window_attributes; |
| - window_attributes.background_pixel = |
| - BlackPixel(x_display_, DefaultScreen(x_display_)); |
| - window_attributes.override_redirect = true; |
| + PlatformInitialize(); |
| - egl_display_ = eglGetDisplay(x_display_); |
| + egl_display_ = PlatformGetDisplay(); |
| + |
| EGLint major; |
| EGLint minor; |
| CHECK(eglInitialize(egl_display_, &major, &minor)) << eglGetError(); |
| @@ -253,28 +251,16 @@ |
| // Arrange X windows whimsically, with some padding. |
| int top_left_x = (width + 20) * (i % 4); |
| int top_left_y = (height + 12) * (i % 3); |
| - Window x_window = XCreateWindow( |
| - x_display_, DefaultRootWindow(x_display_), |
| - top_left_x, top_left_y, width_, height_, |
| - 0 /* border width */, |
| - depth, CopyFromParent /* class */, CopyFromParent /* visual */, |
| - (CWBackPixel | CWOverrideRedirect), &window_attributes); |
| - x_windows_.push_back(x_window); |
| - XStoreName(x_display_, x_window, "OmxVideoDecodeAcceleratorTest"); |
| - XSelectInput(x_display_, x_window, ExposureMask); |
| - XMapWindow(x_display_, x_window); |
| + EGLNativeWindowType window = PlatformCreateWindow(top_left_x, top_left_y); |
| EGLSurface egl_surface = |
| - eglCreateWindowSurface(egl_display_, egl_config, x_window, NULL); |
| + eglCreateWindowSurface(egl_display_, egl_config, window, NULL); |
| egl_surfaces_.push_back(egl_surface); |
| CHECK_NE(egl_surface, EGL_NO_SURFACE); |
| } |
| CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[0], |
| egl_surfaces_[0], egl_context_)) << eglGetError(); |
| - // GLES2 initialization. Note: This is pretty much copy/pasted from |
| - // media/tools/player_x11/gles_video_renderer.cc, with some simplification |
| - // applied. |
| static const float kVertices[] = |
| { -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, 1.f, -1.f, }; |
| static const float kTextureCoordsEgl[] = { 0, 1, 0, 0, 1, 1, 1, 0, }; |
| @@ -319,34 +305,39 @@ |
| glEnableVertexAttribArray(tc_location); |
| glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, |
| kTextureCoordsEgl); |
| - |
| done->Signal(); |
| } |
| -void RenderingHelper::UnInitialize(base::WaitableEvent* done) { |
| +void RenderingHelperBase::UnInitialize(base::WaitableEvent* done) { |
| CHECK_EQ(MessageLoop::current(), message_loop_); |
| - // Destroy resources acquired in Initialize, in reverse-acquisition order. |
| CHECK(eglMakeCurrent(egl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE, |
| EGL_NO_CONTEXT)) << eglGetError(); |
| CHECK(eglDestroyContext(egl_display_, egl_context_)); |
| for (size_t i = 0; i < egl_surfaces_.size(); ++i) |
| CHECK(eglDestroySurface(egl_display_, egl_surfaces_[i])); |
| CHECK(eglTerminate(egl_display_)); |
| - for (size_t i = 0; i < x_windows_.size(); ++i) { |
| - CHECK(XUnmapWindow(x_display_, x_windows_[i])); |
| - CHECK(XDestroyWindow(x_display_, x_windows_[i])); |
| - } |
| - // Mimic newly-created object. |
| Clear(); |
| + PlatformUnInitialize(); |
| done->Signal(); |
| } |
| -void RenderingHelper::CreateTexture(int window_id, GLuint* texture_id, |
| - base::WaitableEvent* done) { |
| +void RenderingHelperBase::Clear() { |
| + suppress_swap_to_display_ = false; |
| + width_ = 0; |
| + height_ = 0; |
| + texture_id_to_surface_index_.clear(); |
| + message_loop_ = NULL; |
| + egl_display_ = EGL_NO_DISPLAY; |
| + egl_context_ = EGL_NO_CONTEXT; |
| + egl_surfaces_.clear(); |
| +} |
| + |
| +void RenderingHelperBase::CreateTexture(int window_id, GLuint* texture_id, |
| + base::WaitableEvent* done) { |
| if (MessageLoop::current() != message_loop_) { |
| message_loop_->PostTask( |
| FROM_HERE, |
| - base::Bind(&RenderingHelper::CreateTexture, base::Unretained(this), |
| + base::Bind(&RenderingHelperBase::CreateTexture, base::Unretained(this), |
| window_id, texture_id, done)); |
| return; |
| } |
| @@ -368,13 +359,14 @@ |
| done->Signal(); |
| } |
| -void RenderingHelper::RenderTexture(GLuint texture_id) { |
| +void RenderingHelperBase::RenderTexture(GLuint texture_id) { |
| CHECK_EQ(MessageLoop::current(), message_loop_); |
| glActiveTexture(GL_TEXTURE0); |
| glBindTexture(GL_TEXTURE_2D, texture_id); |
| glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
| CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| CHECK_EQ(static_cast<int>(eglGetError()), EGL_SUCCESS); |
| + |
| if (!suppress_swap_to_display_) { |
| int window_id = texture_id_to_surface_index_[texture_id]; |
| CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[window_id], |
| @@ -385,11 +377,140 @@ |
| CHECK_EQ(static_cast<int>(eglGetError()), EGL_SUCCESS); |
| } |
| -void RenderingHelper::DeleteTexture(GLuint texture_id) { |
| +void RenderingHelperBase::DeleteTexture(GLuint texture_id) { |
| glDeleteTextures(1, &texture_id); |
| CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| } |
| +#if defined(OS_WIN) |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
Is the sum-total of the difference between the two
ananta
2011/12/20 02:27:22
Done.
|
| +// Provides Windows specific functionality for managing resources like HWND's |
| +// The OpenGL and GLES management is provided by the RenderingHelperBase class. |
| +class RenderingHelper : public RenderingHelperBase { |
| + public: |
| + RenderingHelper(); |
| + virtual ~RenderingHelper(); |
| + |
| + virtual EGLNativeWindowType PlatformCreateWindow(int top_left_x, |
| + int top_left_y) OVERRIDE; |
| + |
| + virtual EGLDisplay PlatformGetDisplay() OVERRIDE; |
| + |
| + virtual void PlatformInitialize() OVERRIDE {}; |
| + |
| + virtual void PlatformUnInitialize() OVERRIDE; |
| + |
| + private: |
| + std::vector<HWND> windows_; |
| +}; |
| + |
| +RenderingHelper::RenderingHelper() |
| + : windows_(NULL) {} |
| + |
| +RenderingHelper::~RenderingHelper() { |
| + PlatformUnInitialize(); |
| +} |
| + |
| +EGLNativeWindowType RenderingHelper::PlatformCreateWindow( |
| + int top_left_x, int top_left_y) { |
| + HWND window = CreateWindowEx(0, L"Static", L"VideoDecodeAcceleratorTest", |
| + WS_OVERLAPPEDWINDOW | WS_VISIBLE, top_left_x, |
| + top_left_y, width_, height_, NULL, NULL, NULL, |
| + NULL); |
| + CHECK(window != NULL); |
| + windows_.push_back(window); |
| + return window; |
| +} |
| + |
| +EGLDisplay RenderingHelper::PlatformGetDisplay() { |
| + return eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| +} |
| + |
| +void RenderingHelper::PlatformUnInitialize() { |
| + for (size_t i = 0; i < windows_.size(); ++i) { |
| + DestroyWindow(windows_[i]); |
| + } |
| + windows_.clear(); |
| +} |
| + |
| +#else // OS_WIN |
| + |
| +// Provides X11 specific functionality for managing X11 resources. The OpenGL |
| +// and GLES management is provided by the RenderingHelperBase class. |
| +class RenderingHelper : public RenderingHelperBase { |
| + public: |
| + explicit RenderingHelper(); |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
Drop explicit.
ananta
2011/12/20 02:27:22
This class has not been deleted. Platform specific
|
| + ~RenderingHelper(); |
| + |
| + virtual void Initialize( |
| + bool suppress_swap_to_display, int num_windows, |
| + int width, int height, base::WaitableEvent* done) OVERRIDE; |
| + |
| + virtual void PlatformInitialize() OVERRIDE; |
| + |
| +// Zero-out internal state. |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
indent
ananta
2011/12/20 02:27:22
Class is now gone.
|
| + virtual void PlatformUnInitialize() OVERRIDE; |
| + |
| + virtual EGLNativeWindowType PlatformCreateWindow(int top_left_x, |
| + int top_left_y) OVERRIDE; |
| + |
| + virtual EGLDisplay PlatformGetDisplay() OVERRIDE; |
| + |
| + private: |
| + // Zero-out internal state. Helper for ctor & UnInitialize(). |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
Drop comment?
|
| + |
| + Display* x_display_; |
| + std::vector<Window> x_windows_; |
| + XSetWindowAttributes window_attributes_; |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
This doesn't need to be a class member (it can jus
ananta
2011/12/20 02:27:22
Done.
|
| +}; |
| + |
| +RenderingHelper::RenderingHelper() { |
| + PlatformUnInitialize(); |
| +} |
| + |
| +RenderingHelper::~RenderingHelper() { |
| +} |
| + |
| +void RenderingHelper::PlatformInitialize() { |
| + CHECK(x_display_ = XOpenDisplay(NULL)); |
| + int depth = DefaultDepth(x_display_, DefaultScreen(x_display_)); |
| + window_attributes_.background_pixel = |
| + BlackPixel(x_display_, DefaultScreen(x_display_)); |
| + window_attributes_.override_redirect = true; |
| +} |
| + |
| +void RenderingHelper::PlatformUnInitialize() { |
| + // Destroy resources acquired in Initialize, in reverse-acquisition order. |
| + for (size_t i = 0; i < x_windows_.size(); ++i) { |
| + CHECK(XUnmapWindow(x_display_, x_windows_[i])); |
| + CHECK(XDestroyWindow(x_display_, x_windows_[i])); |
| + } |
| + // Mimic newly created object. |
| + x_display_ = NULL; |
| + x_windows_.clear(); |
| + memset(&window_attributes_, 0, sizeof(XSetWindowAttributes)); |
| +} |
| + |
| +EGLDisplay RenderingHelper::PlatformGetDisplay() { |
| + return eglGetDisplay(x_display_); |
| +} |
| + |
| +EGLNativeWindowType RenderingHelper::PlatformCreateWindow(int top_left_x, |
| + int top_left_y) { |
| + Window x_window = XCreateWindow( |
| + x_display_, DefaultRootWindow(x_display_), |
| + top_left_x, top_left_y, width_, height_, |
| + 0 /* border width */, |
| + depth, CopyFromParent /* class */, CopyFromParent /* visual */, |
| + (CWBackPixel | CWOverrideRedirect), &window_attributes_); |
| + x_windows_.push_back(x_window); |
| + XStoreName(x_display_, x_window, "VideoDecodeAcceleratorTest"); |
| + XSelectInput(x_display_, x_window, ExposureMask); |
| + XMapWindow(x_display_, x_window); |
| + return x_window; |
| +} |
| + |
| +#endif // OS_WIN |
| + |
| // State of the EglRenderingVDAClient below. Order matters here as the test |
| // makes assumptions about it. |
| enum ClientState { |
| @@ -523,7 +644,7 @@ |
| size_t encoded_data_next_pos_to_decode_; |
| int next_bitstream_buffer_id_; |
| ClientStateNotification* note_; |
| - scoped_refptr<OmxVideoDecodeAccelerator> decoder_; |
| + scoped_refptr<VideoDecodeAccelerator> decoder_; |
| std::set<int> outstanding_texture_ids_; |
| int reset_after_frame_num_; |
| int delete_decoder_state_; |
| @@ -569,8 +690,17 @@ |
| void EglRenderingVDAClient::CreateDecoder() { |
| CHECK(decoder_deleted()); |
| - decoder_ = new OmxVideoDecodeAccelerator(this); |
| - decoder_->SetEglState(egl_display(), egl_context()); |
| +#if defined(OS_WIN) |
| + scoped_refptr<DXVAVideoDecodeAccelerator> decoder; |
| + decoder = new DXVAVideoDecodeAccelerator(this, |
|
Ami GONE FROM CHROMIUM
2011/12/19 22:53:44
assign in previous line
ananta
2011/12/20 02:27:22
Done.
|
| + base::GetCurrentProcessHandle()); |
| + decoder_ = decoder.release(); |
| +#else // OS_WIN |
| + scoped_refptr<OmxVideoDecodeAccelerator> decoder = |
| + new OmxVideoDecodeAccelerator(this); |
| + decoder->SetEglState(egl_display(), egl_context()); |
| + decoder_ = decoder.release(); |
| +#endif // OS_WIN |
| SetState(CS_DECODER_SET); |
| if (decoder_deleted()) |
| return; |
| @@ -785,7 +915,7 @@ |
| // - Number of concurrent in-flight Decode() calls per decoder. |
| // - reset_after_frame_num: see EglRenderingVDAClient ctor. |
| // - delete_decoder_phase: see EglRenderingVDAClient ctor. |
| -class OmxVideoDecodeAcceleratorTest |
| +class VideoDecodeAcceleratorTest |
| : public ::testing::TestWithParam< |
| Tuple5<int, int, int, ResetPoint, ClientState> > { |
| }; |
| @@ -809,7 +939,7 @@ |
| // Test the most straightforward case possible: data is decoded from a single |
| // chunk and rendered to the screen. |
| -TEST_P(OmxVideoDecodeAcceleratorTest, TestSimpleDecode) { |
| +TEST_P(VideoDecodeAcceleratorTest, TestSimpleDecode) { |
| // Can be useful for debugging VLOGs from OVDA. |
| // logging::SetMinLogLevel(-1); |
| @@ -822,7 +952,7 @@ |
| const int reset_after_frame_num = GetParam().d; |
| const int delete_decoder_state = GetParam().e; |
| - std::string test_video_file; |
| + FilePath::StringType test_video_file; |
| int frame_width, frame_height; |
| int num_frames, num_NALUs, min_fps_render, min_fps_no_render, profile; |
| ParseTestVideoData(test_video_data, &test_video_file, &frame_width, |
| @@ -889,7 +1019,8 @@ |
| // We expect initialization to fail only when more than the supported |
| // number of decoders is instantiated. Assert here that something else |
| // didn't trigger failure. |
| - ASSERT_GT(num_concurrent_decoders, kMinSupportedNumConcurrentDecoders); |
| + ASSERT_GT(num_concurrent_decoders, |
| + static_cast<size_t>(kMinSupportedNumConcurrentDecoders)); |
| continue; |
| } |
| ASSERT_EQ(state, CS_INITIALIZED); |
| @@ -947,14 +1078,14 @@ |
| // Test that Reset() mid-stream works fine and doesn't affect decoding even when |
| // Decode() calls are made during the reset. |
| INSTANTIATE_TEST_CASE_P( |
| - MidStreamReset, OmxVideoDecodeAcceleratorTest, |
| + MidStreamReset, VideoDecodeAcceleratorTest, |
| ::testing::Values( |
| MakeTuple(1, 1, 1, static_cast<ResetPoint>(100), CS_RESET))); |
| // Test that Destroy() mid-stream works fine (primarily this is testing that no |
| // crashes occur). |
| INSTANTIATE_TEST_CASE_P( |
| - TearDownTiming, OmxVideoDecodeAcceleratorTest, |
| + TearDownTiming, VideoDecodeAcceleratorTest, |
| ::testing::Values( |
| MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_DECODER_SET), |
| MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_INITIALIZED), |
| @@ -970,7 +1101,7 @@ |
| // Test that decoding various variation works: multiple concurrent decoders and |
| // multiple NALUs per Decode() call. |
| INSTANTIATE_TEST_CASE_P( |
| - DecodeVariations, OmxVideoDecodeAcceleratorTest, |
| + DecodeVariations, VideoDecodeAcceleratorTest, |
| ::testing::Values( |
| MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESET), |
| MakeTuple(1, 1, 10, END_OF_STREAM_RESET, CS_RESET), |
| @@ -991,7 +1122,7 @@ |
| // Find out how many concurrent decoders can go before we exhaust system |
| // resources. |
| INSTANTIATE_TEST_CASE_P( |
| - ResourceExhaustion, OmxVideoDecodeAcceleratorTest, |
| + ResourceExhaustion, VideoDecodeAcceleratorTest, |
| ::testing::Values( |
| // +0 hack below to promote enum to int. |
| MakeTuple(1, kMinSupportedNumConcurrentDecoders + 0, 1, |
| @@ -1009,16 +1140,18 @@ |
| int main(int argc, char **argv) { |
| testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. |
| - CommandLine cmd_line(argc, argv); // Must run after InitGoogleTest. |
| - CommandLine::SwitchMap switches = cmd_line.GetSwitches(); |
| + CommandLine::Init(argc, argv); |
| + |
| + CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| + DCHECK(cmd_line); |
| + |
| + CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
| for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
| it != switches.end(); ++it) { |
| if (it->first == "test_video_data") { |
| test_video_data = it->second.c_str(); |
| - continue; |
| } |
| LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| } |
| - |
| return RUN_ALL_TESTS(); |
| } |