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

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

Issue 2407863002: VDA unittest: fix ~GLRenderingVDAClient crash in debug build. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by 382 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by
383 // the TESTs below. 383 // the TESTs below.
384 class GLRenderingVDAClient 384 class GLRenderingVDAClient
385 : public VideoDecodeAccelerator::Client, 385 : public VideoDecodeAccelerator::Client,
386 public base::SupportsWeakPtr<GLRenderingVDAClient> { 386 public base::SupportsWeakPtr<GLRenderingVDAClient> {
387 public: 387 public:
388 // |window_id| the window_id of the client, which is used to identify the 388 // |window_id| the window_id of the client, which is used to identify the
389 // rendering area in the |rendering_helper|. 389 // rendering area in the |rendering_helper|.
390 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive 390 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive
wuchengli 2016/10/11 02:24:46 FYI. |note| should outlive GLRenderingVDAClient.
391 // |*this|. 391 // |*this|.
392 // |num_play_throughs| indicates how many times to play through the video. 392 // |num_play_throughs| indicates how many times to play through the video.
393 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream 393 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream
394 // Reset() should be done after that frame number is delivered, or 394 // Reset() should be done after that frame number is delivered, or
395 // END_OF_STREAM_RESET to indicate no mid-stream Reset(). 395 // END_OF_STREAM_RESET to indicate no mid-stream Reset().
396 // |delete_decoder_state| indicates when the underlying decoder should be 396 // |delete_decoder_state| indicates when the underlying decoder should be
397 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode() 397 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode()
398 // calls have been made, N>=0 means interpret as ClientState. 398 // calls have been made, N>=0 means interpret as ClientState.
399 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the 399 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the
400 // last play-through (governed by |num_play_throughs|). 400 // last play-through (governed by |num_play_throughs|).
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 // allowed to finish. 1486 // allowed to finish.
1487 if (g_output_log != NULL && delete_decoder_state >= CS_FLUSHED) { 1487 if (g_output_log != NULL && delete_decoder_state >= CS_FLUSHED) {
1488 base::File output_file( 1488 base::File output_file(
1489 base::FilePath(g_output_log), 1489 base::FilePath(g_output_log),
1490 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); 1490 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
1491 for (size_t i = 0; i < num_concurrent_decoders; ++i) { 1491 for (size_t i = 0; i < num_concurrent_decoders; ++i) {
1492 clients[i]->OutputFrameDeliveryTimes(&output_file); 1492 clients[i]->OutputFrameDeliveryTimes(&output_file);
1493 } 1493 }
1494 } 1494 }
1495 1495
1496 std::unique_ptr<ClientsVector> clients2(new ClientsVector);
1497 clients2->swap(clients);
1496 std::unique_ptr<NotesVector> notes2(new NotesVector); 1498 std::unique_ptr<NotesVector> notes2(new NotesVector);
1497 notes2->swap(notes); 1499 notes2->swap(notes);
1498 std::unique_ptr<ClientsVector> clients2(new ClientsVector); 1500
1499 clients2->swap(clients); 1501 // |clients| must be deleted first because |clients| use |notes2|.
1502 g_env->GetRenderingTaskRunner()->PostTask(
1503 FROM_HERE, base::Bind(&Delete<ClientsVector>, base::Passed(&clients2)));
1500 1504
1501 g_env->GetRenderingTaskRunner()->PostTask( 1505 g_env->GetRenderingTaskRunner()->PostTask(
1502 FROM_HERE, base::Bind(&Delete<NotesVector>, base::Passed(&notes2))); 1506 FROM_HERE, base::Bind(&Delete<NotesVector>, base::Passed(&notes2)));
1503 1507
1504 g_env->GetRenderingTaskRunner()->PostTask(
1505 FROM_HERE, base::Bind(&Delete<ClientsVector>, base::Passed(&clients2)));
1506
1507 WaitUntilIdle(); 1508 WaitUntilIdle();
1508 }; 1509 };
1509 1510
1510 // Test that replay after EOS works fine. 1511 // Test that replay after EOS works fine.
1511 INSTANTIATE_TEST_CASE_P( 1512 INSTANTIATE_TEST_CASE_P(
1512 ReplayAfterEOS, 1513 ReplayAfterEOS,
1513 VideoDecodeAcceleratorParamTest, 1514 VideoDecodeAcceleratorParamTest,
1514 ::testing::Values( 1515 ::testing::Values(
1515 std::make_tuple(1, 1, 4, END_OF_STREAM_RESET, CS_RESET, false, false))); 1516 std::make_tuple(1, 1, 4, END_OF_STREAM_RESET, CS_RESET, false, false)));
1516 1517
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 media::VaapiWrapper::PreSandboxInitialization(); 1794 media::VaapiWrapper::PreSandboxInitialization();
1794 #endif 1795 #endif
1795 1796
1796 media::g_env = 1797 media::g_env =
1797 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>( 1798 reinterpret_cast<media::VideoDecodeAcceleratorTestEnvironment*>(
1798 testing::AddGlobalTestEnvironment( 1799 testing::AddGlobalTestEnvironment(
1799 new media::VideoDecodeAcceleratorTestEnvironment())); 1800 new media::VideoDecodeAcceleratorTestEnvironment()));
1800 1801
1801 return RUN_ALL_TESTS(); 1802 return RUN_ALL_TESTS();
1802 } 1803 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698