Skip to content

Commit

Permalink
Cherry pick PR #585: Fix 30 tests from PlayerComponentsTests testcase…
Browse files Browse the repository at this point in the history
… in player_filter_tests. (#675)

* Fix 30 tests from PlayerComponentsTests testcase in player_filter_tests.

b/218420648

Change-Id: Iccf6bc3843fa12796a2a54ec8b16e49da35f7bd9
(cherry picked from commit a40b822)

Co-authored-by: v-kryachko <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and v-kryachko authored Jun 21, 2023
1 parent 953bf85 commit 6e8bc2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ class PlayerComponentsTest
// working.
void RenderAndProcessPendingJobs() {
// Call GetCurrentDecodeTarget() periodically for decode to texture mode.
if (output_mode_ == kSbPlayerOutputModeDecodeToTexture &&
GetVideoRenderer()) {
// Or call fake rendering to force renderer go on in punch-out mode.
if (GetVideoRenderer()) {
#if SB_HAS(GLES2)
fake_graphics_context_provider_.RunOnGlesContextThread(
std::bind(&PlayerComponentsTest::RenderOnGlesContextThread, this));
Expand Down Expand Up @@ -441,7 +441,11 @@ class PlayerComponentsTest
}

void RenderOnGlesContextThread() {
SbDecodeTargetRelease(GetVideoRenderer()->GetCurrentDecodeTarget());
if (output_mode_ == kSbPlayerOutputModeDecodeToTexture) {
SbDecodeTargetRelease(GetVideoRenderer()->GetCurrentDecodeTarget());
} else {
fake_graphics_context_provider_.Render();
}
}

bool TryToWriteOneInputBuffer(SbTime max_timestamp) {
Expand Down
11 changes: 11 additions & 0 deletions starboard/testing/fake_graphics_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@

#define EGL_CALL_SIMPLE(x) (EGL_CALL_PREFIX x)

#define GL_CALL(x) \
do { \
SbGetGlesInterface()->x; \
SB_DCHECK((SbGetGlesInterface()->glGetError()) == SB_GL_NO_ERROR); \
} while (false)

namespace starboard {
namespace testing {

Expand Down Expand Up @@ -291,6 +297,11 @@ void FakeGraphicsContextProvider::MakeNoContextCurrent() {
eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
}

void FakeGraphicsContextProvider::Render() {
GL_CALL(glClear(SB_GL_COLOR_BUFFER_BIT));
EGL_CALL(eglSwapBuffers(display_, surface_));
}

void FakeGraphicsContextProvider::DestroyContext() {
MakeNoContextCurrent();
EGL_CALL_SIMPLE(eglDestroyContext(display_, context_));
Expand Down
2 changes: 2 additions & 0 deletions starboard/testing/fake_graphics_context_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class FakeGraphicsContextProvider {
void ReleaseDecodeTarget(SbDecodeTarget decode_target);
#endif // SB_HAS(GLES2)

void Render();

private:
#if SB_HAS(GLES2)
static void* ThreadEntryPoint(void* context);
Expand Down

0 comments on commit 6e8bc2e

Please sign in to comment.