| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
| 6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
| 7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. | 7 // - RenderingHelper is charged with interacting with X11, EGL, and GLES2. |
| 8 // - ClientState is an enum for the state of the decode client used by the test. | 8 // - ClientState is an enum for the state of the decode client used by the test. |
| 9 // - ClientStateNotification is a barrier abstraction that allows the test code | 9 // - ClientStateNotification is a barrier abstraction that allows the test code |
| 10 // to be written sequentially and wait for the decode client to see certain | 10 // to be written sequentially and wait for the decode client to see certain |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // - |profile| is the media::H264Profile set during Initialization. | 69 // - |profile| is the media::H264Profile set during Initialization. |
| 70 // An empty value for a numeric field means "ignore". | 70 // An empty value for a numeric field means "ignore". |
| 71 #if defined(OS_MACOSX) | 71 #if defined(OS_MACOSX) |
| 72 const FilePath::CharType* test_video_data = | 72 const FilePath::CharType* test_video_data = |
| 73 FILE_PATH_LITERAL("test-25fps_high.h264:1280:720:249:252:50:175:4"); | 73 FILE_PATH_LITERAL("test-25fps_high.h264:1280:720:249:252:50:175:4"); |
| 74 #else | 74 #else |
| 75 const FilePath::CharType* test_video_data = | 75 const FilePath::CharType* test_video_data = |
| 76 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); | 76 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 // AAVC data required to initialize the H.264 video decoder. | |
| 80 // TODO(sail): Remove this and build the AVC configuration record instead. | |
| 81 const uint8 MP4_EXTRA_DATA[] = { | |
| 82 0x01, 0x64, 0x00, 0x1f, 0xff, 0xe1, 0x00, 0x19, | |
| 83 0x67, 0x64, 0x00, 0x1f, 0xac, 0x34, 0xec, 0x05, | |
| 84 0x00, 0x5b, 0xa1, 0x00, 0x00, 0x03, 0x00, 0x01, | |
| 85 0x00, 0x00, 0x03, 0x00, 0x32, 0x0f, 0x18, 0x31, | |
| 86 0x38, 0x01, 0x00, 0x05, 0x68, 0xef, 0xb2, 0xc8, | |
| 87 0xb0, | |
| 88 }; | |
| 89 | |
| 90 // Parse |data| into its constituent parts and set the various output fields | 79 // Parse |data| into its constituent parts and set the various output fields |
| 91 // accordingly. CHECK-fails on unexpected or missing required data. | 80 // accordingly. CHECK-fails on unexpected or missing required data. |
| 92 // Unspecified optional fields are set to -1. | 81 // Unspecified optional fields are set to -1. |
| 93 void ParseTestVideoData(FilePath::StringType data, | 82 void ParseTestVideoData(FilePath::StringType data, |
| 94 FilePath::StringType* file_name, | 83 FilePath::StringType* file_name, |
| 95 int* width, int* height, | 84 int* width, int* height, |
| 96 int* num_frames, | 85 int* num_frames, |
| 97 int* num_NALUs, | 86 int* num_NALUs, |
| 98 int* min_fps_render, | 87 int* min_fps_render, |
| 99 int* min_fps_no_render, | 88 int* min_fps_no_render, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 scoped_refptr<OmxVideoDecodeAccelerator> decoder = | 311 scoped_refptr<OmxVideoDecodeAccelerator> decoder = |
| 323 new OmxVideoDecodeAccelerator(this); | 312 new OmxVideoDecodeAccelerator(this); |
| 324 decoder->SetEglState( | 313 decoder->SetEglState( |
| 325 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 314 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
| 326 static_cast<EGLContext>(rendering_helper_->GetGLContext())); | 315 static_cast<EGLContext>(rendering_helper_->GetGLContext())); |
| 327 #elif defined(OS_MACOSX) | 316 #elif defined(OS_MACOSX) |
| 328 scoped_refptr<MacVideoDecodeAccelerator> decoder = | 317 scoped_refptr<MacVideoDecodeAccelerator> decoder = |
| 329 new MacVideoDecodeAccelerator(this); | 318 new MacVideoDecodeAccelerator(this); |
| 330 decoder->SetCGLContext( | 319 decoder->SetCGLContext( |
| 331 static_cast<CGLContextObj>(rendering_helper_->GetGLContext())); | 320 static_cast<CGLContextObj>(rendering_helper_->GetGLContext())); |
| 332 std::vector<uint8> avc_data(MP4_EXTRA_DATA, | |
| 333 MP4_EXTRA_DATA + arraysize(MP4_EXTRA_DATA)); | |
| 334 if (!decoder->SetConfigInfo(frame_width_, frame_height_, avc_data)) { | |
| 335 SetState(CS_ERROR); | |
| 336 return; | |
| 337 } | |
| 338 #endif // OS_WIN | 321 #endif // OS_WIN |
| 339 decoder_ = decoder.release(); | 322 decoder_ = decoder.release(); |
| 340 SetState(CS_DECODER_SET); | 323 SetState(CS_DECODER_SET); |
| 341 if (decoder_deleted()) | 324 if (decoder_deleted()) |
| 342 return; | 325 return; |
| 343 | 326 |
| 344 // Configure the decoder. | 327 // Configure the decoder. |
| 345 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 328 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
| 346 if (profile_ != -1) | 329 if (profile_ != -1) |
| 347 profile = static_cast<media::VideoCodecProfile>(profile_); | 330 profile = static_cast<media::VideoCodecProfile>(profile_); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 814 |
| 832 base::ShadowingAtExitManager at_exit_manager; | 815 base::ShadowingAtExitManager at_exit_manager; |
| 833 RenderingHelper::InitializePlatform(); | 816 RenderingHelper::InitializePlatform(); |
| 834 | 817 |
| 835 #if defined(OS_WIN) | 818 #if defined(OS_WIN) |
| 836 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 819 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| 837 #endif | 820 #endif |
| 838 | 821 |
| 839 return RUN_ALL_TESTS(); | 822 return RUN_ALL_TESTS(); |
| 840 } | 823 } |
| OLD | NEW |