Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 9346012: Video decode in hardware on ARM platform. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Platform specific Init/Uninit. 147 // Platform specific Init/Uninit.
148 void PlatformInitialize(); 148 void PlatformInitialize();
149 void PlatformUnInitialize(); 149 void PlatformUnInitialize();
150 150
151 // Platform specific window creation. 151 // Platform specific window creation.
152 EGLNativeWindowType PlatformCreateWindow(int top_left_x, int top_left_y); 152 EGLNativeWindowType PlatformCreateWindow(int top_left_x, int top_left_y);
153 153
154 // Platform specific display surface returned here. 154 // Platform specific display surface returned here.
155 EGLDisplay PlatformGetDisplay(); 155 EGLDisplay PlatformGetDisplay();
156 156
157 Display* get_native_disp() { return x_display_; }
158
157 EGLDisplay egl_display() { return egl_display_; } 159 EGLDisplay egl_display() { return egl_display_; }
158 160
159 EGLContext egl_context() { return egl_context_; } 161 EGLContext egl_context() { return egl_context_; }
160 162
163 EGLSurface egl_surface(int w_id) { return egl_surfaces_[w_id]; }
164
161 MessageLoop* message_loop() { return message_loop_; } 165 MessageLoop* message_loop() { return message_loop_; }
162 166
163 protected: 167 protected:
164 void Clear(); 168 void Clear();
165 169
166 // We ensure all operations are carried out on the same thread by remembering 170 // We ensure all operations are carried out on the same thread by remembering
167 // where we were Initialized. 171 // where we were Initialized.
168 MessageLoop* message_loop_; 172 MessageLoop* message_loop_;
169 int width_; 173 int width_;
170 int height_; 174 int height_;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 virtual void NotifyInitializeDone(); 566 virtual void NotifyInitializeDone();
563 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id); 567 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id);
564 virtual void NotifyFlushDone(); 568 virtual void NotifyFlushDone();
565 virtual void NotifyResetDone(); 569 virtual void NotifyResetDone();
566 virtual void NotifyError(VideoDecodeAccelerator::Error error); 570 virtual void NotifyError(VideoDecodeAccelerator::Error error);
567 571
568 // Simple getters for inspecting the state of the Client. 572 // Simple getters for inspecting the state of the Client.
569 ClientState state() { return state_; } 573 ClientState state() { return state_; }
570 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; } 574 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; }
571 int num_decoded_frames() { return num_decoded_frames_; } 575 int num_decoded_frames() { return num_decoded_frames_; }
576 Display* get_native_disp() { return rendering_helper_->get_native_disp(); }
572 EGLDisplay egl_display() { return rendering_helper_->egl_display(); } 577 EGLDisplay egl_display() { return rendering_helper_->egl_display(); }
573 EGLContext egl_context() { return rendering_helper_->egl_context(); } 578 EGLContext egl_context() { return rendering_helper_->egl_context(); }
579 EGLSurface egl_surface(int w_id) {
580 return rendering_helper_->egl_surface(w_id);
581 }
574 double frames_per_second(); 582 double frames_per_second();
575 bool decoder_deleted() { return !decoder_; } 583 bool decoder_deleted() { return !decoder_; }
576 584
577 private: 585 private:
578 typedef std::map<int, media::PictureBuffer*> PictureBufferById; 586 typedef std::map<int, media::PictureBuffer*> PictureBufferById;
579 587
580 void SetState(ClientState new_state); 588 void SetState(ClientState new_state);
581 589
582 // Delete the associated OMX decoder helper. 590 // Delete the associated OMX decoder helper.
583 void DeleteDecoder(); 591 void DeleteDecoder();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 656 }
649 657
650 void EglRenderingVDAClient::CreateDecoder() { 658 void EglRenderingVDAClient::CreateDecoder() {
651 CHECK(decoder_deleted()); 659 CHECK(decoder_deleted());
652 #if defined(OS_WIN) 660 #if defined(OS_WIN)
653 scoped_refptr<DXVAVideoDecodeAccelerator> decoder = 661 scoped_refptr<DXVAVideoDecodeAccelerator> decoder =
654 new DXVAVideoDecodeAccelerator(this, base::GetCurrentProcessHandle()); 662 new DXVAVideoDecodeAccelerator(this, base::GetCurrentProcessHandle());
655 #else // OS_WIN 663 #else // OS_WIN
656 scoped_refptr<OmxVideoDecodeAccelerator> decoder = 664 scoped_refptr<OmxVideoDecodeAccelerator> decoder =
657 new OmxVideoDecodeAccelerator(this); 665 new OmxVideoDecodeAccelerator(this);
658 decoder->SetEglState(egl_display(), egl_context()); 666 decoder->SetEglState(get_native_disp(),
667 egl_display(), egl_context(),
668 egl_surface(rendering_window_id_) );
659 #endif // OS_WIN 669 #endif // OS_WIN
660 decoder_ = decoder.release(); 670 decoder_ = decoder.release();
661 SetState(CS_DECODER_SET); 671 SetState(CS_DECODER_SET);
662 if (decoder_deleted()) 672 if (decoder_deleted())
663 return; 673 return;
664 674
665 // Configure the decoder. 675 // Configure the decoder.
666 media::VideoDecodeAccelerator::Profile profile = media::H264PROFILE_BASELINE; 676 media::VideoDecodeAccelerator::Profile profile = media::H264PROFILE_BASELINE;
667 if (profile_ != -1) 677 if (profile_ != -1)
668 profile = static_cast<media::VideoDecodeAccelerator::Profile>(profile_); 678 profile = static_cast<media::VideoDecodeAccelerator::Profile>(profile_);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1162 }
1153 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1163 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1154 } 1164 }
1155 #if defined(OS_WIN) 1165 #if defined(OS_WIN)
1156 base::ShadowingAtExitManager at_exit_manager; 1166 base::ShadowingAtExitManager at_exit_manager;
1157 gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2); 1167 gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2);
1158 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); 1168 DXVAVideoDecodeAccelerator::PreSandboxInitialization();
1159 #endif // OS_WIN 1169 #endif // OS_WIN
1160 return RUN_ALL_TESTS(); 1170 return RUN_ALL_TESTS();
1161 } 1171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698