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/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 |
11 // to be written sequentially and wait for the decode client to see certain | 11 // to be written sequentially and wait for the decode client to see certain |
12 // state transitions. | 12 // state transitions. |
13 // - GLRenderingVDAClient is a VideoDecodeAccelerator::Client implementation | 13 // - GLRenderingVDAClient is a VideoDecodeAccelerator::Client implementation |
14 // - Finally actual TEST cases are at the bottom of this file, using the above | 14 // - Finally actual TEST cases are at the bottom of this file, using the above |
15 // infrastructure. | 15 // infrastructure. |
16 | 16 |
17 #include <fcntl.h> | 17 #include <fcntl.h> |
18 #include <math.h> | |
19 #include <sys/stat.h> | 18 #include <sys/stat.h> |
20 #include <sys/types.h> | 19 #include <sys/types.h> |
21 #include <deque> | 20 #include <deque> |
22 | 21 |
23 // Include gtest.h out of order because <X11/X.h> #define's Bool & None, which | 22 // Include gtest.h out of order because <X11/X.h> #define's Bool & None, which |
24 // gtest uses as struct names (inside a namespace). This means that | 23 // gtest uses as struct names (inside a namespace). This means that |
25 // #include'ing gtest after anything that pulls in X.h fails to compile. | 24 // #include'ing gtest after anything that pulls in X.h fails to compile. |
26 // This is http://code.google.com/p/googletest/issues/detail?id=371 | 25 // This is http://code.google.com/p/googletest/issues/detail?id=371 |
27 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
28 | 27 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 392 } |
394 | 393 |
395 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by | 394 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by |
396 // the TESTs below. | 395 // the TESTs below. |
397 class GLRenderingVDAClient | 396 class GLRenderingVDAClient |
398 : public VideoDecodeAccelerator::Client, | 397 : public VideoDecodeAccelerator::Client, |
399 public base::SupportsWeakPtr<GLRenderingVDAClient> { | 398 public base::SupportsWeakPtr<GLRenderingVDAClient> { |
400 public: | 399 public: |
401 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive | 400 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive |
402 // |*this|. | 401 // |*this|. |
403 // |num_fragments_per_decode| counts NALUs for h264 and frames for VP8. | |
404 // |num_play_throughs| indicates how many times to play through the video. | 402 // |num_play_throughs| indicates how many times to play through the video. |
405 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream | 403 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream |
406 // Reset() should be done after that frame number is delivered, or | 404 // Reset() should be done after that frame number is delivered, or |
407 // END_OF_STREAM_RESET to indicate no mid-stream Reset(). | 405 // END_OF_STREAM_RESET to indicate no mid-stream Reset(). |
408 // |delete_decoder_state| indicates when the underlying decoder should be | 406 // |delete_decoder_state| indicates when the underlying decoder should be |
409 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode() | 407 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode() |
410 // calls have been made, N>=0 means interpret as ClientState. | 408 // calls have been made, N>=0 means interpret as ClientState. |
411 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the | 409 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the |
412 // last play-through (governed by |num_play_throughs|). | 410 // last play-through (governed by |num_play_throughs|). |
413 // |rendering_fps| indicates the target rendering fps. 0 means no target fps | 411 // |rendering_fps| indicates the target rendering fps. 0 means no target fps |
414 // and it would render as fast as possible. | 412 // and it would render as fast as possible. |
415 // |suppress_rendering| indicates GL rendering is suppressed or not. | 413 // |suppress_rendering| indicates GL rendering is suppressed or not. |
416 // After |delay_reuse_after_frame_num| frame has been delivered, the client | 414 // After |delay_reuse_after_frame_num| frame has been delivered, the client |
417 // will start delaying the call to ReusePictureBuffer() for kReuseDelay. | 415 // will start delaying the call to ReusePictureBuffer() for kReuseDelay. |
418 GLRenderingVDAClient(RenderingHelper* rendering_helper, | 416 GLRenderingVDAClient(RenderingHelper* rendering_helper, |
419 int rendering_window_id, | 417 int rendering_window_id, |
420 ClientStateNotification<ClientState>* note, | 418 ClientStateNotification<ClientState>* note, |
421 const std::string& encoded_data, | 419 const std::string& encoded_data, |
422 int num_fragments_per_decode, | |
423 int num_in_flight_decodes, | 420 int num_in_flight_decodes, |
424 int num_play_throughs, | 421 int num_play_throughs, |
425 int reset_after_frame_num, | 422 int reset_after_frame_num, |
426 int delete_decoder_state, | 423 int delete_decoder_state, |
427 int frame_width, | 424 int frame_width, |
428 int frame_height, | 425 int frame_height, |
429 int profile, | 426 int profile, |
430 double rendering_fps, | 427 double rendering_fps, |
431 bool suppress_rendering, | 428 bool suppress_rendering, |
432 int delay_reuse_after_frame_num); | 429 int delay_reuse_after_frame_num); |
(...skipping 28 matching lines...) Expand all Loading... |
461 | 458 |
462 private: | 459 private: |
463 typedef std::map<int, media::PictureBuffer*> PictureBufferById; | 460 typedef std::map<int, media::PictureBuffer*> PictureBufferById; |
464 | 461 |
465 void SetState(ClientState new_state); | 462 void SetState(ClientState new_state); |
466 | 463 |
467 // Delete the associated decoder helper. | 464 // Delete the associated decoder helper. |
468 void DeleteDecoder(); | 465 void DeleteDecoder(); |
469 | 466 |
470 // Compute & return the first encoded bytes (including a start frame) to send | 467 // Compute & return the first encoded bytes (including a start frame) to send |
471 // to the decoder, starting at |start_pos| and returning | 468 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
472 // |num_fragments_per_decode| units. Skips to the first decodable position. | 469 // to the first decodable position. |
473 std::string GetBytesForFirstFragments(size_t start_pos, size_t* end_pos); | 470 std::string GetBytesForFirstFragment(size_t start_pos, size_t* end_pos); |
474 // Compute & return the next encoded bytes to send to the decoder (based on | 471 // Compute & return the encoded bytes of next fragment to send to the decoder |
475 // |start_pos| & |num_fragments_per_decode_|). | 472 // (based on |start_pos|). |
476 std::string GetBytesForNextFragments(size_t start_pos, size_t* end_pos); | 473 std::string GetBytesForNextFragment(size_t start_pos, size_t* end_pos); |
477 // Helpers for GetRangeForNextFragments above. | 474 // Helpers for GetBytesForNextFragment above. |
478 void GetBytesForNextNALU(size_t start_pos, size_t* end_pos); // For h.264. | 475 void GetBytesForNextNALU(size_t start_pos, size_t* end_pos); // For h.264. |
479 std::string GetBytesForNextFrames( | 476 std::string GetBytesForNextFrame( |
480 size_t start_pos, size_t* end_pos); // For VP8. | 477 size_t start_pos, size_t* end_pos); // For VP8. |
481 | 478 |
482 // Request decode of the next batch of fragments in the encoded data. | 479 // Request decode of the next fragment in the encoded data. |
483 void DecodeNextFragments(); | 480 void DecodeNextFragment(); |
484 | 481 |
485 RenderingHelper* rendering_helper_; | 482 RenderingHelper* rendering_helper_; |
486 int rendering_window_id_; | 483 int rendering_window_id_; |
487 std::string encoded_data_; | 484 std::string encoded_data_; |
488 const int num_fragments_per_decode_; | |
489 const int num_in_flight_decodes_; | 485 const int num_in_flight_decodes_; |
490 int outstanding_decodes_; | 486 int outstanding_decodes_; |
491 size_t encoded_data_next_pos_to_decode_; | 487 size_t encoded_data_next_pos_to_decode_; |
492 int next_bitstream_buffer_id_; | 488 int next_bitstream_buffer_id_; |
493 ClientStateNotification<ClientState>* note_; | 489 ClientStateNotification<ClientState>* note_; |
494 scoped_ptr<VideoDecodeAccelerator> decoder_; | 490 scoped_ptr<VideoDecodeAccelerator> decoder_; |
495 std::set<int> outstanding_texture_ids_; | 491 std::set<int> outstanding_texture_ids_; |
496 int remaining_play_throughs_; | 492 int remaining_play_throughs_; |
497 int reset_after_frame_num_; | 493 int reset_after_frame_num_; |
498 int delete_decoder_state_; | 494 int delete_decoder_state_; |
(...skipping 11 matching lines...) Expand all Loading... |
510 scoped_ptr<ThrottlingVDAClient> throttling_client_; | 506 scoped_ptr<ThrottlingVDAClient> throttling_client_; |
511 | 507 |
512 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); | 508 DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient); |
513 }; | 509 }; |
514 | 510 |
515 GLRenderingVDAClient::GLRenderingVDAClient( | 511 GLRenderingVDAClient::GLRenderingVDAClient( |
516 RenderingHelper* rendering_helper, | 512 RenderingHelper* rendering_helper, |
517 int rendering_window_id, | 513 int rendering_window_id, |
518 ClientStateNotification<ClientState>* note, | 514 ClientStateNotification<ClientState>* note, |
519 const std::string& encoded_data, | 515 const std::string& encoded_data, |
520 int num_fragments_per_decode, | |
521 int num_in_flight_decodes, | 516 int num_in_flight_decodes, |
522 int num_play_throughs, | 517 int num_play_throughs, |
523 int reset_after_frame_num, | 518 int reset_after_frame_num, |
524 int delete_decoder_state, | 519 int delete_decoder_state, |
525 int frame_width, | 520 int frame_width, |
526 int frame_height, | 521 int frame_height, |
527 int profile, | 522 int profile, |
528 double rendering_fps, | 523 double rendering_fps, |
529 bool suppress_rendering, | 524 bool suppress_rendering, |
530 int delay_reuse_after_frame_num) | 525 int delay_reuse_after_frame_num) |
531 : rendering_helper_(rendering_helper), | 526 : rendering_helper_(rendering_helper), |
532 rendering_window_id_(rendering_window_id), | 527 rendering_window_id_(rendering_window_id), |
533 encoded_data_(encoded_data), | 528 encoded_data_(encoded_data), |
534 num_fragments_per_decode_(num_fragments_per_decode), | |
535 num_in_flight_decodes_(num_in_flight_decodes), | 529 num_in_flight_decodes_(num_in_flight_decodes), |
536 outstanding_decodes_(0), | 530 outstanding_decodes_(0), |
537 encoded_data_next_pos_to_decode_(0), | 531 encoded_data_next_pos_to_decode_(0), |
538 next_bitstream_buffer_id_(0), | 532 next_bitstream_buffer_id_(0), |
539 note_(note), | 533 note_(note), |
540 remaining_play_throughs_(num_play_throughs), | 534 remaining_play_throughs_(num_play_throughs), |
541 reset_after_frame_num_(reset_after_frame_num), | 535 reset_after_frame_num_(reset_after_frame_num), |
542 delete_decoder_state_(delete_decoder_state), | 536 delete_decoder_state_(delete_decoder_state), |
543 state_(CS_CREATED), | 537 state_(CS_CREATED), |
544 num_skipped_fragments_(0), | 538 num_skipped_fragments_(0), |
545 num_queued_fragments_(0), | 539 num_queued_fragments_(0), |
546 num_decoded_frames_(0), | 540 num_decoded_frames_(0), |
547 num_done_bitstream_buffers_(0), | 541 num_done_bitstream_buffers_(0), |
548 profile_(profile), | 542 profile_(profile), |
549 suppress_rendering_(suppress_rendering), | 543 suppress_rendering_(suppress_rendering), |
550 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { | 544 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { |
551 CHECK_GT(num_fragments_per_decode, 0); | |
552 CHECK_GT(num_in_flight_decodes, 0); | 545 CHECK_GT(num_in_flight_decodes, 0); |
553 CHECK_GT(num_play_throughs, 0); | 546 CHECK_GT(num_play_throughs, 0); |
554 CHECK_GE(rendering_fps, 0); | 547 CHECK_GE(rendering_fps, 0); |
555 if (rendering_fps > 0) | 548 if (rendering_fps > 0) |
556 throttling_client_.reset(new ThrottlingVDAClient( | 549 throttling_client_.reset(new ThrottlingVDAClient( |
557 this, | 550 this, |
558 rendering_fps, | 551 rendering_fps, |
559 base::Bind(&GLRenderingVDAClient::NotifyFrameDropped, | 552 base::Bind(&GLRenderingVDAClient::NotifyFrameDropped, |
560 base::Unretained(this)))); | 553 base::Unretained(this)))); |
561 } | 554 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 void GLRenderingVDAClient::NotifyInitializeDone() { | 683 void GLRenderingVDAClient::NotifyInitializeDone() { |
691 SetState(CS_INITIALIZED); | 684 SetState(CS_INITIALIZED); |
692 initialize_done_ticks_ = base::TimeTicks::Now(); | 685 initialize_done_ticks_ = base::TimeTicks::Now(); |
693 | 686 |
694 if (reset_after_frame_num_ == START_OF_STREAM_RESET) { | 687 if (reset_after_frame_num_ == START_OF_STREAM_RESET) { |
695 decoder_->Reset(); | 688 decoder_->Reset(); |
696 return; | 689 return; |
697 } | 690 } |
698 | 691 |
699 for (int i = 0; i < num_in_flight_decodes_; ++i) | 692 for (int i = 0; i < num_in_flight_decodes_; ++i) |
700 DecodeNextFragments(); | 693 DecodeNextFragment(); |
701 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 694 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
702 } | 695 } |
703 | 696 |
704 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( | 697 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( |
705 int32 bitstream_buffer_id) { | 698 int32 bitstream_buffer_id) { |
706 // TODO(fischman): this test currently relies on this notification to make | 699 // TODO(fischman): this test currently relies on this notification to make |
707 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 700 // forward progress during a Reset(). But the VDA::Reset() API doesn't |
708 // guarantee this, so stop relying on it (and remove the notifications from | 701 // guarantee this, so stop relying on it (and remove the notifications from |
709 // VaapiVideoDecodeAccelerator::FinishReset()). | 702 // VaapiVideoDecodeAccelerator::FinishReset()). |
710 ++num_done_bitstream_buffers_; | 703 ++num_done_bitstream_buffers_; |
711 --outstanding_decodes_; | 704 --outstanding_decodes_; |
712 DecodeNextFragments(); | 705 DecodeNextFragment(); |
713 } | 706 } |
714 | 707 |
715 void GLRenderingVDAClient::NotifyFlushDone() { | 708 void GLRenderingVDAClient::NotifyFlushDone() { |
716 if (decoder_deleted()) | 709 if (decoder_deleted()) |
717 return; | 710 return; |
718 SetState(CS_FLUSHED); | 711 SetState(CS_FLUSHED); |
719 --remaining_play_throughs_; | 712 --remaining_play_throughs_; |
720 DCHECK_GE(remaining_play_throughs_, 0); | 713 DCHECK_GE(remaining_play_throughs_, 0); |
721 if (decoder_deleted()) | 714 if (decoder_deleted()) |
722 return; | 715 return; |
723 decoder_->Reset(); | 716 decoder_->Reset(); |
724 SetState(CS_RESETTING); | 717 SetState(CS_RESETTING); |
725 } | 718 } |
726 | 719 |
727 void GLRenderingVDAClient::NotifyResetDone() { | 720 void GLRenderingVDAClient::NotifyResetDone() { |
728 if (decoder_deleted()) | 721 if (decoder_deleted()) |
729 return; | 722 return; |
730 | 723 |
731 if (reset_after_frame_num_ == MID_STREAM_RESET) { | 724 if (reset_after_frame_num_ == MID_STREAM_RESET) { |
732 reset_after_frame_num_ = END_OF_STREAM_RESET; | 725 reset_after_frame_num_ = END_OF_STREAM_RESET; |
733 DecodeNextFragments(); | 726 DecodeNextFragment(); |
734 return; | 727 return; |
735 } else if (reset_after_frame_num_ == START_OF_STREAM_RESET) { | 728 } else if (reset_after_frame_num_ == START_OF_STREAM_RESET) { |
736 reset_after_frame_num_ = END_OF_STREAM_RESET; | 729 reset_after_frame_num_ = END_OF_STREAM_RESET; |
737 for (int i = 0; i < num_in_flight_decodes_; ++i) | 730 for (int i = 0; i < num_in_flight_decodes_; ++i) |
738 DecodeNextFragments(); | 731 DecodeNextFragment(); |
739 return; | 732 return; |
740 } | 733 } |
741 | 734 |
742 if (remaining_play_throughs_) { | 735 if (remaining_play_throughs_) { |
743 encoded_data_next_pos_to_decode_ = 0; | 736 encoded_data_next_pos_to_decode_ = 0; |
744 NotifyInitializeDone(); | 737 NotifyInitializeDone(); |
745 return; | 738 return; |
746 } | 739 } |
747 | 740 |
748 SetState(CS_RESET); | 741 SetState(CS_RESET); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 for (std::set<int>::iterator it = outstanding_texture_ids_.begin(); | 787 for (std::set<int>::iterator it = outstanding_texture_ids_.begin(); |
795 it != outstanding_texture_ids_.end(); ++it) { | 788 it != outstanding_texture_ids_.end(); ++it) { |
796 rendering_helper_->DeleteTexture(*it); | 789 rendering_helper_->DeleteTexture(*it); |
797 } | 790 } |
798 outstanding_texture_ids_.clear(); | 791 outstanding_texture_ids_.clear(); |
799 // Cascade through the rest of the states to simplify test code below. | 792 // Cascade through the rest of the states to simplify test code below. |
800 for (int i = state_ + 1; i < CS_MAX; ++i) | 793 for (int i = state_ + 1; i < CS_MAX; ++i) |
801 SetState(static_cast<ClientState>(i)); | 794 SetState(static_cast<ClientState>(i)); |
802 } | 795 } |
803 | 796 |
804 std::string GLRenderingVDAClient::GetBytesForFirstFragments( | 797 std::string GLRenderingVDAClient::GetBytesForFirstFragment( |
805 size_t start_pos, size_t* end_pos) { | 798 size_t start_pos, size_t* end_pos) { |
806 if (profile_ < media::H264PROFILE_MAX) { | 799 if (profile_ < media::H264PROFILE_MAX) { |
807 *end_pos = start_pos; | 800 *end_pos = start_pos; |
808 while (*end_pos + 4 < encoded_data_.size()) { | 801 while (*end_pos + 4 < encoded_data_.size()) { |
809 if ((encoded_data_[*end_pos + 4] & 0x1f) == 0x7) // SPS start frame | 802 if ((encoded_data_[*end_pos + 4] & 0x1f) == 0x7) // SPS start frame |
810 return GetBytesForNextFragments(*end_pos, end_pos); | 803 return GetBytesForNextFragment(*end_pos, end_pos); |
811 GetBytesForNextNALU(*end_pos, end_pos); | 804 GetBytesForNextNALU(*end_pos, end_pos); |
812 num_skipped_fragments_++; | 805 num_skipped_fragments_++; |
813 } | 806 } |
814 *end_pos = start_pos; | 807 *end_pos = start_pos; |
815 return std::string(); | 808 return std::string(); |
816 } | 809 } |
817 DCHECK_LE(profile_, media::VP8PROFILE_MAX); | 810 DCHECK_LE(profile_, media::VP8PROFILE_MAX); |
818 return GetBytesForNextFragments(start_pos, end_pos); | 811 return GetBytesForNextFragment(start_pos, end_pos); |
819 } | 812 } |
820 | 813 |
821 std::string GLRenderingVDAClient::GetBytesForNextFragments( | 814 std::string GLRenderingVDAClient::GetBytesForNextFragment( |
822 size_t start_pos, size_t* end_pos) { | 815 size_t start_pos, size_t* end_pos) { |
823 if (profile_ < media::H264PROFILE_MAX) { | 816 if (profile_ < media::H264PROFILE_MAX) { |
824 size_t new_end_pos = start_pos; | |
825 *end_pos = start_pos; | 817 *end_pos = start_pos; |
826 for (int i = 0; i < num_fragments_per_decode_; ++i) { | 818 GetBytesForNextNALU(*end_pos, end_pos); |
827 GetBytesForNextNALU(*end_pos, &new_end_pos); | 819 if (start_pos != *end_pos) { |
828 if (*end_pos == new_end_pos) | |
829 break; | |
830 *end_pos = new_end_pos; | |
831 num_queued_fragments_++; | 820 num_queued_fragments_++; |
832 } | 821 } |
833 return encoded_data_.substr(start_pos, *end_pos - start_pos); | 822 return encoded_data_.substr(start_pos, *end_pos - start_pos); |
834 } | 823 } |
835 DCHECK_LE(profile_, media::VP8PROFILE_MAX); | 824 DCHECK_LE(profile_, media::VP8PROFILE_MAX); |
836 return GetBytesForNextFrames(start_pos, end_pos); | 825 return GetBytesForNextFrame(start_pos, end_pos); |
837 } | 826 } |
838 | 827 |
839 void GLRenderingVDAClient::GetBytesForNextNALU( | 828 void GLRenderingVDAClient::GetBytesForNextNALU( |
840 size_t start_pos, size_t* end_pos) { | 829 size_t start_pos, size_t* end_pos) { |
841 *end_pos = start_pos; | 830 *end_pos = start_pos; |
842 if (*end_pos + 4 > encoded_data_.size()) | 831 if (*end_pos + 4 > encoded_data_.size()) |
843 return; | 832 return; |
844 CHECK(LookingAtNAL(encoded_data_, start_pos)); | 833 CHECK(LookingAtNAL(encoded_data_, start_pos)); |
845 *end_pos += 4; | 834 *end_pos += 4; |
846 while (*end_pos + 4 <= encoded_data_.size() && | 835 while (*end_pos + 4 <= encoded_data_.size() && |
847 !LookingAtNAL(encoded_data_, *end_pos)) { | 836 !LookingAtNAL(encoded_data_, *end_pos)) { |
848 ++*end_pos; | 837 ++*end_pos; |
849 } | 838 } |
850 if (*end_pos + 3 >= encoded_data_.size()) | 839 if (*end_pos + 3 >= encoded_data_.size()) |
851 *end_pos = encoded_data_.size(); | 840 *end_pos = encoded_data_.size(); |
852 } | 841 } |
853 | 842 |
854 std::string GLRenderingVDAClient::GetBytesForNextFrames( | 843 std::string GLRenderingVDAClient::GetBytesForNextFrame( |
855 size_t start_pos, size_t* end_pos) { | 844 size_t start_pos, size_t* end_pos) { |
856 // Helpful description: http://wiki.multimedia.cx/index.php?title=IVF | 845 // Helpful description: http://wiki.multimedia.cx/index.php?title=IVF |
857 std::string bytes; | 846 std::string bytes; |
858 if (start_pos == 0) | 847 if (start_pos == 0) |
859 start_pos = 32; // Skip IVF header. | 848 start_pos = 32; // Skip IVF header. |
860 *end_pos = start_pos; | 849 *end_pos = start_pos; |
861 for (int i = 0; i < num_fragments_per_decode_; ++i) { | 850 uint32 frame_size = *reinterpret_cast<uint32*>(&encoded_data_[*end_pos]); |
862 uint32 frame_size = *reinterpret_cast<uint32*>(&encoded_data_[*end_pos]); | 851 *end_pos += 12; // Skip frame header. |
863 *end_pos += 12; // Skip frame header. | 852 bytes.append(encoded_data_.substr(*end_pos, frame_size)); |
864 bytes.append(encoded_data_.substr(*end_pos, frame_size)); | 853 *end_pos += frame_size; |
865 *end_pos += frame_size; | 854 num_queued_fragments_++; |
866 num_queued_fragments_++; | |
867 if (*end_pos + 12 >= encoded_data_.size()) | |
868 return bytes; | |
869 } | |
870 return bytes; | 855 return bytes; |
871 } | 856 } |
872 | 857 |
873 void GLRenderingVDAClient::DecodeNextFragments() { | 858 void GLRenderingVDAClient::DecodeNextFragment() { |
874 if (decoder_deleted()) | 859 if (decoder_deleted()) |
875 return; | 860 return; |
876 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { | 861 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { |
877 if (outstanding_decodes_ == 0) { | 862 if (outstanding_decodes_ == 0) { |
878 decoder_->Flush(); | 863 decoder_->Flush(); |
879 SetState(CS_FLUSHING); | 864 SetState(CS_FLUSHING); |
880 } | 865 } |
881 return; | 866 return; |
882 } | 867 } |
883 size_t end_pos; | 868 size_t end_pos; |
884 std::string next_fragment_bytes; | 869 std::string next_fragment_bytes; |
885 if (encoded_data_next_pos_to_decode_ == 0) { | 870 if (encoded_data_next_pos_to_decode_ == 0) { |
886 next_fragment_bytes = GetBytesForFirstFragments(0, &end_pos); | 871 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos); |
887 } else { | 872 } else { |
888 next_fragment_bytes = | 873 next_fragment_bytes = |
889 GetBytesForNextFragments(encoded_data_next_pos_to_decode_, &end_pos); | 874 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos); |
890 } | 875 } |
891 size_t next_fragment_size = next_fragment_bytes.size(); | 876 size_t next_fragment_size = next_fragment_bytes.size(); |
892 | 877 |
893 // Populate the shared memory buffer w/ the fragments, duplicate its handle, | 878 // Populate the shared memory buffer w/ the fragment, duplicate its handle, |
894 // and hand it off to the decoder. | 879 // and hand it off to the decoder. |
895 base::SharedMemory shm; | 880 base::SharedMemory shm; |
896 CHECK(shm.CreateAndMapAnonymous(next_fragment_size)); | 881 CHECK(shm.CreateAndMapAnonymous(next_fragment_size)); |
897 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size); | 882 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size); |
898 base::SharedMemoryHandle dup_handle; | 883 base::SharedMemoryHandle dup_handle; |
899 CHECK(shm.ShareToProcess(base::Process::Current().handle(), &dup_handle)); | 884 CHECK(shm.ShareToProcess(base::Process::Current().handle(), &dup_handle)); |
900 media::BitstreamBuffer bitstream_buffer( | 885 media::BitstreamBuffer bitstream_buffer( |
901 next_bitstream_buffer_id_, dup_handle, next_fragment_size); | 886 next_bitstream_buffer_id_, dup_handle, next_fragment_size); |
902 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. | 887 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. |
903 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; | 888 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; |
(...skipping 13 matching lines...) Expand all Loading... |
917 } | 902 } |
918 | 903 |
919 double GLRenderingVDAClient::frames_per_second() { | 904 double GLRenderingVDAClient::frames_per_second() { |
920 base::TimeDelta delta = frame_delivery_times_.back() - initialize_done_ticks_; | 905 base::TimeDelta delta = frame_delivery_times_.back() - initialize_done_ticks_; |
921 if (delta.InSecondsF() == 0) | 906 if (delta.InSecondsF() == 0) |
922 return 0; | 907 return 0; |
923 return num_decoded_frames() / delta.InSecondsF(); | 908 return num_decoded_frames() / delta.InSecondsF(); |
924 } | 909 } |
925 | 910 |
926 // Test parameters: | 911 // Test parameters: |
927 // - Number of fragments per Decode() call. | |
928 // - Number of concurrent decoders. | 912 // - Number of concurrent decoders. |
929 // - Number of concurrent in-flight Decode() calls per decoder. | 913 // - Number of concurrent in-flight Decode() calls per decoder. |
930 // - Number of play-throughs. | 914 // - Number of play-throughs. |
931 // - reset_after_frame_num: see GLRenderingVDAClient ctor. | 915 // - reset_after_frame_num: see GLRenderingVDAClient ctor. |
932 // - delete_decoder_phase: see GLRenderingVDAClient ctor. | 916 // - delete_decoder_phase: see GLRenderingVDAClient ctor. |
933 // - whether to test slow rendering by delaying ReusePictureBuffer(). | 917 // - whether to test slow rendering by delaying ReusePictureBuffer(). |
934 // - whether the video frames are rendered as thumbnails. | 918 // - whether the video frames are rendered as thumbnails. |
935 class VideoDecodeAcceleratorTest | 919 class VideoDecodeAcceleratorTest |
936 : public ::testing::TestWithParam< | 920 : public ::testing::TestWithParam< |
937 Tuple8<int, int, int, int, ResetPoint, ClientState, bool, bool> > { | 921 Tuple7<int, int, int, ResetPoint, ClientState, bool, bool> > { |
938 }; | 922 }; |
939 | 923 |
940 // Helper so that gtest failures emit a more readable version of the tuple than | 924 // Helper so that gtest failures emit a more readable version of the tuple than |
941 // its byte representation. | 925 // its byte representation. |
942 ::std::ostream& operator<<( | 926 ::std::ostream& operator<<( |
943 ::std::ostream& os, | 927 ::std::ostream& os, |
944 const Tuple8<int, int, int, int, ResetPoint, ClientState, bool, bool>& t) { | 928 const Tuple7<int, int, int, ResetPoint, ClientState, bool, bool>& t) { |
945 return os << t.a << ", " << t.b << ", " << t.c << ", " << t.d << ", " << t.e | 929 return os << t.a << ", " << t.b << ", " << t.c << ", " << t.d << ", " << t.e |
946 << ", " << t.f << ", " << t.g << ", " << t.h; | 930 << ", " << t.f << ", " << t.g; |
947 } | 931 } |
948 | 932 |
949 // Wait for |note| to report a state and if it's not |expected_state| then | 933 // Wait for |note| to report a state and if it's not |expected_state| then |
950 // assert |client| has deleted its decoder. | 934 // assert |client| has deleted its decoder. |
951 static void AssertWaitForStateOrDeleted( | 935 static void AssertWaitForStateOrDeleted( |
952 ClientStateNotification<ClientState>* note, | 936 ClientStateNotification<ClientState>* note, |
953 GLRenderingVDAClient* client, | 937 GLRenderingVDAClient* client, |
954 ClientState expected_state) { | 938 ClientState expected_state) { |
955 ClientState state = note->Wait(); | 939 ClientState state = note->Wait(); |
956 if (state == expected_state) return; | 940 if (state == expected_state) return; |
957 ASSERT_TRUE(client->decoder_deleted()) | 941 ASSERT_TRUE(client->decoder_deleted()) |
958 << "Decoder not deleted but Wait() returned " << state | 942 << "Decoder not deleted but Wait() returned " << state |
959 << ", instead of " << expected_state; | 943 << ", instead of " << expected_state; |
960 } | 944 } |
961 | 945 |
962 // We assert a minimal number of concurrent decoders we expect to succeed. | 946 // We assert a minimal number of concurrent decoders we expect to succeed. |
963 // Different platforms can support more concurrent decoders, so we don't assert | 947 // Different platforms can support more concurrent decoders, so we don't assert |
964 // failure above this. | 948 // failure above this. |
965 enum { kMinSupportedNumConcurrentDecoders = 3 }; | 949 enum { kMinSupportedNumConcurrentDecoders = 3 }; |
966 | 950 |
967 // Test the most straightforward case possible: data is decoded from a single | 951 // Test the most straightforward case possible: data is decoded from a single |
968 // chunk and rendered to the screen. | 952 // chunk and rendered to the screen. |
969 TEST_P(VideoDecodeAcceleratorTest, TestSimpleDecode) { | 953 TEST_P(VideoDecodeAcceleratorTest, TestSimpleDecode) { |
970 // Required for Thread to work. Not used otherwise. | 954 // Required for Thread to work. Not used otherwise. |
971 base::ShadowingAtExitManager at_exit_manager; | 955 base::ShadowingAtExitManager at_exit_manager; |
972 | 956 |
973 const int num_fragments_per_decode = GetParam().a; | 957 const size_t num_concurrent_decoders = GetParam().a; |
974 const size_t num_concurrent_decoders = GetParam().b; | 958 const size_t num_in_flight_decodes = GetParam().b; |
975 const size_t num_in_flight_decodes = GetParam().c; | 959 const int num_play_throughs = GetParam().c; |
976 const int num_play_throughs = GetParam().d; | 960 const int reset_point = GetParam().d; |
977 const int reset_point = GetParam().e; | 961 const int delete_decoder_state = GetParam().e; |
978 const int delete_decoder_state = GetParam().f; | 962 bool test_reuse_delay = GetParam().f; |
979 bool test_reuse_delay = GetParam().g; | 963 const bool render_as_thumbnails = GetParam().g; |
980 const bool render_as_thumbnails = GetParam().h; | |
981 | 964 |
982 std::vector<TestVideoFile*> test_video_files; | 965 std::vector<TestVideoFile*> test_video_files; |
983 ParseAndReadTestVideoData(g_test_video_data, | 966 ParseAndReadTestVideoData(g_test_video_data, |
984 num_concurrent_decoders, | 967 num_concurrent_decoders, |
985 reset_point, | 968 reset_point, |
986 &test_video_files); | 969 &test_video_files); |
987 | 970 |
988 // Suppress GL rendering for all tests when the "--disable_rendering" is set. | 971 // Suppress GL rendering for all tests when the "--disable_rendering" is set. |
989 // Otherwise, suppress rendering in all but a few tests, to cut down overall | 972 const bool suppress_rendering = g_disable_rendering; |
990 // test runtime. | |
991 const bool suppress_rendering = | |
992 num_fragments_per_decode > 1 || g_disable_rendering; | |
993 | 973 |
994 std::vector<ClientStateNotification<ClientState>*> | 974 std::vector<ClientStateNotification<ClientState>*> |
995 notes(num_concurrent_decoders, NULL); | 975 notes(num_concurrent_decoders, NULL); |
996 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, NULL); | 976 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, NULL); |
997 | 977 |
998 // Initialize the rendering helper. | 978 // Initialize the rendering helper. |
999 base::Thread rendering_thread("GLRenderingVDAClientThread"); | 979 base::Thread rendering_thread("GLRenderingVDAClientThread"); |
1000 base::Thread::Options options; | 980 base::Thread::Options options; |
1001 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 981 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
1002 #if defined(OS_WIN) | 982 #if defined(OS_WIN) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 if (test_reuse_delay && | 1029 if (test_reuse_delay && |
1050 kMaxFramesToDelayReuse * 2 < video_file->num_frames) { | 1030 kMaxFramesToDelayReuse * 2 < video_file->num_frames) { |
1051 delay_after_frame_num = video_file->num_frames - kMaxFramesToDelayReuse; | 1031 delay_after_frame_num = video_file->num_frames - kMaxFramesToDelayReuse; |
1052 } | 1032 } |
1053 | 1033 |
1054 GLRenderingVDAClient* client = | 1034 GLRenderingVDAClient* client = |
1055 new GLRenderingVDAClient(&rendering_helper, | 1035 new GLRenderingVDAClient(&rendering_helper, |
1056 index, | 1036 index, |
1057 note, | 1037 note, |
1058 video_file->data_str, | 1038 video_file->data_str, |
1059 num_fragments_per_decode, | |
1060 num_in_flight_decodes, | 1039 num_in_flight_decodes, |
1061 num_play_throughs, | 1040 num_play_throughs, |
1062 video_file->reset_after_frame_num, | 1041 video_file->reset_after_frame_num, |
1063 delete_decoder_state, | 1042 delete_decoder_state, |
1064 video_file->width, | 1043 video_file->width, |
1065 video_file->height, | 1044 video_file->height, |
1066 video_file->profile, | 1045 video_file->profile, |
1067 g_rendering_fps, | 1046 g_rendering_fps, |
1068 suppress_rendering, | 1047 suppress_rendering, |
1069 delay_after_frame_num); | 1048 delay_after_frame_num); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 // could still be returned until resetting done. | 1108 // could still be returned until resetting done. |
1130 if (video_file->reset_after_frame_num > 0) | 1109 if (video_file->reset_after_frame_num > 0) |
1131 EXPECT_GE(client->num_decoded_frames(), video_file->num_frames); | 1110 EXPECT_GE(client->num_decoded_frames(), video_file->num_frames); |
1132 else | 1111 else |
1133 EXPECT_EQ(client->num_decoded_frames(), video_file->num_frames); | 1112 EXPECT_EQ(client->num_decoded_frames(), video_file->num_frames); |
1134 } | 1113 } |
1135 if (reset_point == END_OF_STREAM_RESET) { | 1114 if (reset_point == END_OF_STREAM_RESET) { |
1136 EXPECT_EQ(video_file->num_fragments, client->num_skipped_fragments() + | 1115 EXPECT_EQ(video_file->num_fragments, client->num_skipped_fragments() + |
1137 client->num_queued_fragments()); | 1116 client->num_queued_fragments()); |
1138 EXPECT_EQ(client->num_done_bitstream_buffers(), | 1117 EXPECT_EQ(client->num_done_bitstream_buffers(), |
1139 ceil(static_cast<double>(client->num_queued_fragments()) / | 1118 client->num_queued_fragments()); |
1140 num_fragments_per_decode)); | |
1141 } | 1119 } |
1142 LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second(); | 1120 LOG(INFO) << "Decoder " << i << " fps: " << client->frames_per_second(); |
1143 if (!render_as_thumbnails) { | 1121 if (!render_as_thumbnails) { |
1144 int min_fps = suppress_rendering ? | 1122 int min_fps = suppress_rendering ? |
1145 video_file->min_fps_no_render : video_file->min_fps_render; | 1123 video_file->min_fps_no_render : video_file->min_fps_render; |
1146 if (min_fps > 0 && !test_reuse_delay) | 1124 if (min_fps > 0 && !test_reuse_delay) |
1147 EXPECT_GT(client->frames_per_second(), min_fps); | 1125 EXPECT_GT(client->frames_per_second(), min_fps); |
1148 } | 1126 } |
1149 } | 1127 } |
1150 | 1128 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 base::Unretained(&rendering_helper), | 1201 base::Unretained(&rendering_helper), |
1224 &done)); | 1202 &done)); |
1225 done.Wait(); | 1203 done.Wait(); |
1226 rendering_thread.Stop(); | 1204 rendering_thread.Stop(); |
1227 }; | 1205 }; |
1228 | 1206 |
1229 // Test that replay after EOS works fine. | 1207 // Test that replay after EOS works fine. |
1230 INSTANTIATE_TEST_CASE_P( | 1208 INSTANTIATE_TEST_CASE_P( |
1231 ReplayAfterEOS, VideoDecodeAcceleratorTest, | 1209 ReplayAfterEOS, VideoDecodeAcceleratorTest, |
1232 ::testing::Values( | 1210 ::testing::Values( |
1233 MakeTuple(1, 1, 1, 4, END_OF_STREAM_RESET, CS_RESET, false, false))); | 1211 MakeTuple(1, 1, 4, END_OF_STREAM_RESET, CS_RESET, false, false))); |
1234 | 1212 |
1235 // This hangs on Exynos, preventing further testing and wasting test machine | 1213 // This hangs on Exynos, preventing further testing and wasting test machine |
1236 // time. | 1214 // time. |
1237 // TODO(ihf): Enable again once http://crbug.com/269754 is fixed. | 1215 // TODO(ihf): Enable again once http://crbug.com/269754 is fixed. |
1238 #if defined(ARCH_CPU_X86_FAMILY) | 1216 #if defined(ARCH_CPU_X86_FAMILY) |
1239 // Test that Reset() before the first Decode() works fine. | 1217 // Test that Reset() before the first Decode() works fine. |
1240 INSTANTIATE_TEST_CASE_P( | 1218 INSTANTIATE_TEST_CASE_P( |
1241 ResetBeforeDecode, VideoDecodeAcceleratorTest, | 1219 ResetBeforeDecode, VideoDecodeAcceleratorTest, |
1242 ::testing::Values( | 1220 ::testing::Values( |
1243 MakeTuple(1, 1, 1, 1, START_OF_STREAM_RESET, CS_RESET, false, false))); | 1221 MakeTuple(1, 1, 1, START_OF_STREAM_RESET, CS_RESET, false, false))); |
1244 #endif // ARCH_CPU_X86_FAMILY | 1222 #endif // ARCH_CPU_X86_FAMILY |
1245 | 1223 |
1246 // Test that Reset() mid-stream works fine and doesn't affect decoding even when | 1224 // Test that Reset() mid-stream works fine and doesn't affect decoding even when |
1247 // Decode() calls are made during the reset. | 1225 // Decode() calls are made during the reset. |
1248 INSTANTIATE_TEST_CASE_P( | 1226 INSTANTIATE_TEST_CASE_P( |
1249 MidStreamReset, VideoDecodeAcceleratorTest, | 1227 MidStreamReset, VideoDecodeAcceleratorTest, |
1250 ::testing::Values( | 1228 ::testing::Values( |
1251 MakeTuple(1, 1, 1, 1, MID_STREAM_RESET, CS_RESET, false, false))); | 1229 MakeTuple(1, 1, 1, MID_STREAM_RESET, CS_RESET, false, false))); |
1252 | 1230 |
1253 INSTANTIATE_TEST_CASE_P( | 1231 INSTANTIATE_TEST_CASE_P( |
1254 SlowRendering, VideoDecodeAcceleratorTest, | 1232 SlowRendering, VideoDecodeAcceleratorTest, |
1255 ::testing::Values( | 1233 ::testing::Values( |
1256 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, true, false))); | 1234 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESET, true, false))); |
1257 | 1235 |
1258 // Test that Destroy() mid-stream works fine (primarily this is testing that no | 1236 // Test that Destroy() mid-stream works fine (primarily this is testing that no |
1259 // crashes occur). | 1237 // crashes occur). |
1260 INSTANTIATE_TEST_CASE_P( | 1238 INSTANTIATE_TEST_CASE_P( |
1261 TearDownTiming, VideoDecodeAcceleratorTest, | 1239 TearDownTiming, VideoDecodeAcceleratorTest, |
1262 ::testing::Values( | 1240 ::testing::Values( |
1263 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_DECODER_SET, false, | 1241 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_DECODER_SET, false, false), |
1264 false), | 1242 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_INITIALIZED, false, false), |
1265 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_INITIALIZED, false, | 1243 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_FLUSHING, false, false), |
1266 false), | 1244 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_FLUSHED, false, false), |
1267 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_FLUSHING, false, false), | 1245 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESETTING, false, false), |
1268 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_FLUSHED, false, false), | 1246 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), |
1269 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_RESETTING, false, false), | 1247 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, |
1270 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | |
1271 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, | |
1272 static_cast<ClientState>(-1), false, false), | 1248 static_cast<ClientState>(-1), false, false), |
1273 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, | 1249 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, |
1274 static_cast<ClientState>(-10), false, false), | 1250 static_cast<ClientState>(-10), false, false), |
1275 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, | 1251 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, |
1276 static_cast<ClientState>(-100), false, false))); | 1252 static_cast<ClientState>(-100), false, false))); |
1277 | 1253 |
1278 // Test that decoding various variation works: multiple fragments per Decode() | 1254 // Test that decoding various variation works with multiple in-flight decodes. |
1279 // call and multiple in-flight decodes. | |
1280 INSTANTIATE_TEST_CASE_P( | 1255 INSTANTIATE_TEST_CASE_P( |
1281 DecodeVariations, VideoDecodeAcceleratorTest, | 1256 DecodeVariations, VideoDecodeAcceleratorTest, |
1282 ::testing::Values( | 1257 ::testing::Values( |
1283 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | 1258 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), |
1284 MakeTuple(1, 1, 10, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | 1259 MakeTuple(1, 10, 1, END_OF_STREAM_RESET, CS_RESET, false, false), |
1285 // Tests queuing. | 1260 // Tests queuing. |
1286 MakeTuple(1, 1, 15, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | 1261 MakeTuple(1, 15, 1, END_OF_STREAM_RESET, CS_RESET, false, false))); |
1287 MakeTuple(2, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | |
1288 MakeTuple(3, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | |
1289 MakeTuple(5, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | |
1290 MakeTuple(8, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false), | |
1291 // TODO(fischman): decoding more than 15 NALUs at once breaks decode - | |
1292 // visual artifacts are introduced as well as spurious frames are | |
1293 // delivered (more pictures are returned than NALUs are fed to the | |
1294 // decoder). Increase the "15" below when | |
1295 // http://code.google.com/p/chrome-os-partner/issues/detail?id=4378 is | |
1296 // fixed. | |
1297 MakeTuple(15, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, false))); | |
1298 | 1262 |
1299 // Find out how many concurrent decoders can go before we exhaust system | 1263 // Find out how many concurrent decoders can go before we exhaust system |
1300 // resources. | 1264 // resources. |
1301 INSTANTIATE_TEST_CASE_P( | 1265 INSTANTIATE_TEST_CASE_P( |
1302 ResourceExhaustion, VideoDecodeAcceleratorTest, | 1266 ResourceExhaustion, VideoDecodeAcceleratorTest, |
1303 ::testing::Values( | 1267 ::testing::Values( |
1304 // +0 hack below to promote enum to int. | 1268 // +0 hack below to promote enum to int. |
1305 MakeTuple(1, kMinSupportedNumConcurrentDecoders + 0, 1, 1, | 1269 MakeTuple(kMinSupportedNumConcurrentDecoders + 0, 1, 1, |
1306 END_OF_STREAM_RESET, CS_RESET, false, false), | 1270 END_OF_STREAM_RESET, CS_RESET, false, false), |
1307 MakeTuple(1, kMinSupportedNumConcurrentDecoders + 1, 1, 1, | 1271 MakeTuple(kMinSupportedNumConcurrentDecoders + 1, 1, 1, |
1308 END_OF_STREAM_RESET, CS_RESET, false, false))); | 1272 END_OF_STREAM_RESET, CS_RESET, false, false))); |
1309 | 1273 |
1310 // Thumbnailing test | 1274 // Thumbnailing test |
1311 INSTANTIATE_TEST_CASE_P( | 1275 INSTANTIATE_TEST_CASE_P( |
1312 Thumbnail, VideoDecodeAcceleratorTest, | 1276 Thumbnail, VideoDecodeAcceleratorTest, |
1313 ::testing::Values( | 1277 ::testing::Values( |
1314 MakeTuple(1, 1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, true))); | 1278 MakeTuple(1, 1, 1, END_OF_STREAM_RESET, CS_RESET, false, true))); |
1315 | 1279 |
1316 // TODO(fischman, vrk): add more tests! In particular: | 1280 // TODO(fischman, vrk): add more tests! In particular: |
1317 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. | 1281 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. |
1318 // - Test alternate configurations | 1282 // - Test alternate configurations |
1319 // - Test failure conditions. | 1283 // - Test failure conditions. |
1320 // - Test frame size changes mid-stream | 1284 // - Test frame size changes mid-stream |
1321 | 1285 |
1322 } // namespace | 1286 } // namespace |
1323 } // namespace content | 1287 } // namespace content |
1324 | 1288 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 #elif defined(OS_CHROMEOS) | 1334 #elif defined(OS_CHROMEOS) |
1371 #if defined(ARCH_CPU_ARMEL) | 1335 #if defined(ARCH_CPU_ARMEL) |
1372 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); | 1336 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); |
1373 #elif defined(ARCH_CPU_X86_FAMILY) | 1337 #elif defined(ARCH_CPU_X86_FAMILY) |
1374 content::VaapiWrapper::PreSandboxInitialization(); | 1338 content::VaapiWrapper::PreSandboxInitialization(); |
1375 #endif // ARCH_CPU_ARMEL | 1339 #endif // ARCH_CPU_ARMEL |
1376 #endif // OS_CHROMEOS | 1340 #endif // OS_CHROMEOS |
1377 | 1341 |
1378 return RUN_ALL_TESTS(); | 1342 return RUN_ALL_TESTS(); |
1379 } | 1343 } |
OLD | NEW |