OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "media/gpu/rendering_helper.h" | 5 #include "media/gpu/rendering_helper.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // It's safe to use Unretained here since |rendering_thread_| will be stopped | 728 // It's safe to use Unretained here since |rendering_thread_| will be stopped |
729 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is | 729 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is |
730 // a member of that class. (See video_decode_accelerator_unittest.cc.) | 730 // a member of that class. (See video_decode_accelerator_unittest.cc.) |
731 gfx::VSyncProvider* vsync_provider = gl_surface_->GetVSyncProvider(); | 731 gfx::VSyncProvider* vsync_provider = gl_surface_->GetVSyncProvider(); |
732 if (vsync_provider && !ignore_vsync_) { | 732 if (vsync_provider && !ignore_vsync_) { |
733 vsync_provider->GetVSyncParameters(base::Bind( | 733 vsync_provider->GetVSyncParameters(base::Bind( |
734 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), | 734 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), |
735 static_cast<base::WaitableEvent*>(NULL))); | 735 static_cast<base::WaitableEvent*>(NULL))); |
736 } | 736 } |
737 | 737 |
738 int tex_flip = 1; | 738 int tex_flip = !gl_surface_->FlipsVertically(); |
739 #if defined(USE_OZONE) | 739 #if defined(USE_OZONE) |
740 // Ozone surfaceless renders flipped from normal GL, so there's no need to | 740 // Ozone surfaceless renders flipped from normal GL, so there's no need to |
741 // do an extra flip. | 741 // do an extra flip. |
742 tex_flip = 0; | 742 tex_flip = 0; |
743 #endif // defined(USE_OZONE) | 743 #endif // defined(USE_OZONE) |
744 glUniform1i(glGetUniformLocation(program_, "tex_flip"), tex_flip); | 744 glUniform1i(glGetUniformLocation(program_, "tex_flip"), tex_flip); |
745 | 745 |
746 // Frames that will be returned to the client (via the no_longer_needed_cb) | 746 // Frames that will be returned to the client (via the no_longer_needed_cb) |
747 // after this vector falls out of scope at the end of this method. We need | 747 // after this vector falls out of scope at the end of this method. We need |
748 // to keep references to them until after SwapBuffers() call below. | 748 // to keep references to them until after SwapBuffers() call below. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 // When the rendering falls behind, drops frames. | 883 // When the rendering falls behind, drops frames. |
884 while (scheduled_render_time_ < target) { | 884 while (scheduled_render_time_ < target) { |
885 scheduled_render_time_ += frame_duration_; | 885 scheduled_render_time_ += frame_duration_; |
886 DropOneFrameForAllVideos(); | 886 DropOneFrameForAllVideos(); |
887 } | 887 } |
888 | 888 |
889 message_loop_->task_runner()->PostDelayedTask( | 889 message_loop_->task_runner()->PostDelayedTask( |
890 FROM_HERE, render_task_.callback(), target - now); | 890 FROM_HERE, render_task_.callback(), target - now); |
891 } | 891 } |
892 } // namespace media | 892 } // namespace media |
OLD | NEW |