Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
|
wuchengli
2014/12/09 14:29:24
The change description should have a summary follo
hellner1
2014/12/10 22:38:59
Done.
I did run vea unittests. But since cast_uni
| |
| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/sys_byteorder.h" | 15 #include "base/sys_byteorder.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 17 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/base/bitstream_buffer.h" | 19 #include "media/base/bitstream_buffer.h" |
| 20 #include "media/base/test_data_util.h" | 20 #include "media/base/test_data_util.h" |
| 21 #include "media/filters/h264_parser.h" | 21 #include "media/filters/h264_parser.h" |
| 22 #include "media/video/video_encode_accelerator.h" | 22 #include "media/video/video_encode_accelerator.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 #if defined(USE_X11) | 25 #if defined(USE_X11) |
| 26 #include "ui/gfx/x/x11_types.h" | 26 #include "ui/gfx/x/x11_types.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 #include "media/video/fake_video_encode_accelerator.h" | |
|
wuchengli
2014/12/09 14:29:24
move this before #include "media/video/video_encod
hellner1
2014/12/10 22:38:59
Done.
| |
| 30 | |
| 29 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 31 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 30 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 32 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
| 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 33 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 32 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 34 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
| 33 #else | 35 #else |
| 34 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. | 36 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. |
| 35 #endif | 37 #endif |
| 36 | 38 |
| 37 using media::VideoEncodeAccelerator; | 39 using media::VideoEncodeAccelerator; |
| 38 | 40 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 uint64_t timestamp; // 64-bit presentation timestamp | 123 uint64_t timestamp; // 64-bit presentation timestamp |
| 122 } __attribute__((packed)); | 124 } __attribute__((packed)); |
| 123 | 125 |
| 124 struct TestStream { | 126 struct TestStream { |
| 125 TestStream() | 127 TestStream() |
| 126 : num_frames(0), | 128 : num_frames(0), |
| 127 aligned_buffer_size(0), | 129 aligned_buffer_size(0), |
| 128 requested_bitrate(0), | 130 requested_bitrate(0), |
| 129 requested_framerate(0), | 131 requested_framerate(0), |
| 130 requested_subsequent_bitrate(0), | 132 requested_subsequent_bitrate(0), |
| 131 requested_subsequent_framerate(0) {} | 133 requested_subsequent_framerate(0), |
| 134 fake_encoder(0) {} | |
|
wuchengli
2014/12/09 14:29:24
Do you want to use different encoders for differen
hellner1
2014/12/10 22:38:58
I made fake_encoder selection a command line argum
| |
| 132 ~TestStream() {} | 135 ~TestStream() {} |
| 133 | 136 |
| 134 gfx::Size visible_size; | 137 gfx::Size visible_size; |
| 135 gfx::Size coded_size; | 138 gfx::Size coded_size; |
| 136 unsigned int num_frames; | 139 unsigned int num_frames; |
| 137 | 140 |
| 138 // Original unaligned input file name provided as an argument to the test. | 141 // Original unaligned input file name provided as an argument to the test. |
| 139 // And the file must be an I420 (YUV planar) raw stream. | 142 // And the file must be an I420 (YUV planar) raw stream. |
| 140 std::string in_filename; | 143 std::string in_filename; |
| 141 | 144 |
| 142 // A temporary file used to prepare aligned input buffers of |in_filename|. | 145 // A temporary file used to prepare aligned input buffers of |in_filename|. |
| 143 // The file makes sure starting address of YUV planes are 64 byte-aligned. | 146 // The file makes sure starting address of YUV planes are 64 byte-aligned. |
| 144 base::FilePath aligned_in_file; | 147 base::FilePath aligned_in_file; |
| 145 | 148 |
| 146 // The memory mapping of |aligned_in_file| | 149 // The memory mapping of |aligned_in_file| |
| 147 base::MemoryMappedFile mapped_aligned_in_file; | 150 base::MemoryMappedFile mapped_aligned_in_file; |
| 148 | 151 |
| 149 // Byte size of a frame of |aligned_in_file|. | 152 // Byte size of a frame of |aligned_in_file|. |
| 150 size_t aligned_buffer_size; | 153 size_t aligned_buffer_size; |
| 151 | 154 |
| 152 // Byte size for each aligned plane of a frame | 155 // Byte size for each aligned plane of a frame |
| 153 std::vector<size_t> aligned_plane_size; | 156 std::vector<size_t> aligned_plane_size; |
| 154 | 157 |
| 155 std::string out_filename; | 158 std::string out_filename; |
| 156 media::VideoCodecProfile requested_profile; | 159 media::VideoCodecProfile requested_profile; |
| 157 unsigned int requested_bitrate; | 160 unsigned int requested_bitrate; |
| 158 unsigned int requested_framerate; | 161 unsigned int requested_framerate; |
| 159 unsigned int requested_subsequent_bitrate; | 162 unsigned int requested_subsequent_bitrate; |
| 160 unsigned int requested_subsequent_framerate; | 163 unsigned int requested_subsequent_framerate; |
| 164 int fake_encoder; | |
|
wuchengli
2014/12/09 14:29:24
Use bool.
hellner1
2014/12/10 22:38:58
Done.
| |
| 161 }; | 165 }; |
| 162 | 166 |
| 163 inline static size_t Align64Bytes(size_t value) { | 167 inline static size_t Align64Bytes(size_t value) { |
| 164 return (value + 63) & ~63; | 168 return (value + 63) & ~63; |
| 165 } | 169 } |
| 166 | 170 |
| 167 // Write |data| of |size| bytes at |offset| bytes into |file|. | 171 // Write |data| of |size| bytes at |offset| bytes into |file|. |
| 168 static bool WriteFile(base::File* file, | 172 static bool WriteFile(base::File* file, |
| 169 const off_t offset, | 173 const off_t offset, |
| 170 const uint8* data, | 174 const uint8* data, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 // Split the string to individual test stream data. | 301 // Split the string to individual test stream data. |
| 298 std::vector<base::FilePath::StringType> test_streams_data; | 302 std::vector<base::FilePath::StringType> test_streams_data; |
| 299 base::SplitString(data, ';', &test_streams_data); | 303 base::SplitString(data, ';', &test_streams_data); |
| 300 CHECK_GE(test_streams_data.size(), 1U) << data; | 304 CHECK_GE(test_streams_data.size(), 1U) << data; |
| 301 | 305 |
| 302 // Parse each test stream data and read the input file. | 306 // Parse each test stream data and read the input file. |
| 303 for (size_t index = 0; index < test_streams_data.size(); ++index) { | 307 for (size_t index = 0; index < test_streams_data.size(); ++index) { |
| 304 std::vector<base::FilePath::StringType> fields; | 308 std::vector<base::FilePath::StringType> fields; |
| 305 base::SplitString(test_streams_data[index], ':', &fields); | 309 base::SplitString(test_streams_data[index], ':', &fields); |
| 306 CHECK_GE(fields.size(), 4U) << data; | 310 CHECK_GE(fields.size(), 4U) << data; |
| 307 CHECK_LE(fields.size(), 9U) << data; | 311 CHECK_LE(fields.size(), 10U) << data; |
| 308 TestStream* test_stream = new TestStream(); | 312 TestStream* test_stream = new TestStream(); |
| 309 | 313 |
| 310 test_stream->in_filename = fields[0]; | 314 test_stream->in_filename = fields[0]; |
| 311 int width, height; | 315 int width, height; |
| 312 CHECK(base::StringToInt(fields[1], &width)); | 316 CHECK(base::StringToInt(fields[1], &width)); |
| 313 CHECK(base::StringToInt(fields[2], &height)); | 317 CHECK(base::StringToInt(fields[2], &height)); |
| 314 test_stream->visible_size = gfx::Size(width, height); | 318 test_stream->visible_size = gfx::Size(width, height); |
| 315 CHECK(!test_stream->visible_size.IsEmpty()); | 319 CHECK(!test_stream->visible_size.IsEmpty()); |
| 316 int profile; | 320 int profile; |
| 317 CHECK(base::StringToInt(fields[3], &profile)); | 321 CHECK(base::StringToInt(fields[3], &profile)); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 331 | 335 |
| 332 if (fields.size() >= 8 && !fields[7].empty()) { | 336 if (fields.size() >= 8 && !fields[7].empty()) { |
| 333 CHECK(base::StringToUint(fields[7], | 337 CHECK(base::StringToUint(fields[7], |
| 334 &test_stream->requested_subsequent_bitrate)); | 338 &test_stream->requested_subsequent_bitrate)); |
| 335 } | 339 } |
| 336 | 340 |
| 337 if (fields.size() >= 9 && !fields[8].empty()) { | 341 if (fields.size() >= 9 && !fields[8].empty()) { |
| 338 CHECK(base::StringToUint(fields[8], | 342 CHECK(base::StringToUint(fields[8], |
| 339 &test_stream->requested_subsequent_framerate)); | 343 &test_stream->requested_subsequent_framerate)); |
| 340 } | 344 } |
| 345 if (fields.size() >= 10 && !fields[9].empty()) { | |
| 346 CHECK(base::StringToInt(fields[9], &test_stream->fake_encoder)); | |
| 347 } | |
| 341 test_streams->push_back(test_stream); | 348 test_streams->push_back(test_stream); |
| 342 } | 349 } |
| 343 } | 350 } |
| 344 | 351 |
| 345 enum ClientState { | 352 enum ClientState { |
| 346 CS_CREATED, | 353 CS_CREATED, |
| 347 CS_ENCODER_SET, | 354 CS_ENCODER_SET, |
| 348 CS_INITIALIZED, | 355 CS_INITIALIZED, |
| 349 CS_ENCODING, | 356 CS_ENCODING, |
| 350 CS_FINISHED, | 357 CS_FINISHED, |
| 351 CS_ERROR, | 358 CS_ERROR, |
| 352 }; | 359 }; |
| 353 | 360 |
| 354 // Performs basic, codec-specific sanity checks on the stream buffers passed | 361 // Performs basic, codec-specific sanity checks on the stream buffers passed |
| 355 // to ProcessStreamBuffer(): whether we've seen keyframes before non-keyframes, | 362 // to ProcessStreamBuffer(): whether we've seen keyframes before non-keyframes, |
| 356 // correct sequences of H.264 NALUs (SPS before PPS and before slices), etc. | 363 // correct sequences of H.264 NALUs (SPS before PPS and before slices), etc. |
| 357 // Calls given FrameFoundCallback when a complete frame is found while | 364 // Calls given FrameFoundCallback when a complete frame is found while |
| 358 // processing. | 365 // processing. |
| 359 class StreamValidator { | 366 class StreamValidator { |
| 360 public: | 367 public: |
| 361 // To be called when a complete frame is found while processing a stream | 368 // To be called when a complete frame is found while processing a stream |
| 362 // buffer, passing true if the frame is a keyframe. Returns false if we | 369 // buffer, passing true if the frame is a keyframe. Returns false if we |
| 363 // are not interested in more frames and further processing should be aborted. | 370 // are not interested in more frames and further processing should be aborted. |
| 364 typedef base::Callback<bool(bool)> FrameFoundCallback; | 371 typedef base::Callback<bool(bool)> FrameFoundCallback; |
| 365 | 372 |
| 366 virtual ~StreamValidator() {} | 373 virtual ~StreamValidator() {} |
| 367 | 374 |
| 368 // Provide a StreamValidator instance for the given |profile|. | 375 // Provide a StreamValidator instance for the given |profile|. |
| 369 static scoped_ptr<StreamValidator> Create(media::VideoCodecProfile profile, | 376 static scoped_ptr<StreamValidator> Create(media::VideoCodecProfile profile, |
| 370 const FrameFoundCallback& frame_cb); | 377 const FrameFoundCallback& frame_cb, |
| 378 bool fake_stream); | |
| 371 | 379 |
| 372 // Process and verify contents of a bitstream buffer. | 380 // Process and verify contents of a bitstream buffer. |
| 373 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) = 0; | 381 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) = 0; |
| 374 | 382 |
| 375 protected: | 383 protected: |
| 376 explicit StreamValidator(const FrameFoundCallback& frame_cb) | 384 explicit StreamValidator(const FrameFoundCallback& frame_cb) |
| 377 : frame_cb_(frame_cb) {} | 385 : frame_cb_(frame_cb) {} |
| 378 | 386 |
| 379 FrameFoundCallback frame_cb_; | 387 FrameFoundCallback frame_cb_; |
| 380 }; | 388 }; |
| 381 | 389 |
| 390 class PassThroughValidator : public StreamValidator { | |
| 391 public: | |
| 392 explicit PassThroughValidator(const FrameFoundCallback& frame_cb) | |
| 393 : StreamValidator(frame_cb) {} | |
| 394 void ProcessStreamBuffer(const uint8* stream, size_t size) override; | |
| 395 }; | |
| 396 | |
| 397 void PassThroughValidator::ProcessStreamBuffer( | |
| 398 const uint8* stream, | |
| 399 size_t size) { | |
| 400 const bool keyframe = !(stream[0] & 0x01); | |
|
wuchengli
2014/12/09 14:29:25
This is a hidden dependency to FakeVideoEncodeAcce
hellner1
2014/12/10 22:38:58
Removed the need for this as suggested in other co
| |
| 401 frame_cb_.Run(keyframe); | |
| 402 } | |
| 403 | |
| 382 class H264Validator : public StreamValidator { | 404 class H264Validator : public StreamValidator { |
| 383 public: | 405 public: |
| 384 explicit H264Validator(const FrameFoundCallback& frame_cb) | 406 explicit H264Validator(const FrameFoundCallback& frame_cb) |
| 385 : StreamValidator(frame_cb), | 407 : StreamValidator(frame_cb), |
| 386 seen_sps_(false), | 408 seen_sps_(false), |
| 387 seen_pps_(false), | 409 seen_pps_(false), |
| 388 seen_idr_(false) {} | 410 seen_idr_(false) {} |
| 389 | 411 |
| 390 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) override; | 412 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) override; |
| 391 | 413 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 | 492 |
| 471 frame_cb_.Run(keyframe); | 493 frame_cb_.Run(keyframe); |
| 472 // TODO(posciak): We could be getting more frames in the buffer, but there is | 494 // TODO(posciak): We could be getting more frames in the buffer, but there is |
| 473 // no simple way to detect this. We'd need to parse the frames and go through | 495 // no simple way to detect this. We'd need to parse the frames and go through |
| 474 // partition numbers/sizes. For now assume one frame per buffer. | 496 // partition numbers/sizes. For now assume one frame per buffer. |
| 475 } | 497 } |
| 476 | 498 |
| 477 // static | 499 // static |
| 478 scoped_ptr<StreamValidator> StreamValidator::Create( | 500 scoped_ptr<StreamValidator> StreamValidator::Create( |
| 479 media::VideoCodecProfile profile, | 501 media::VideoCodecProfile profile, |
| 480 const FrameFoundCallback& frame_cb) { | 502 const FrameFoundCallback& frame_cb, |
| 503 bool fake_stream) { | |
| 481 scoped_ptr<StreamValidator> validator; | 504 scoped_ptr<StreamValidator> validator; |
| 482 | 505 |
| 483 if (IsH264(profile)) { | 506 if (fake_stream) { |
| 507 validator.reset(new PassThroughValidator(frame_cb)); | |
| 508 } else if (IsH264(profile)) { | |
| 484 validator.reset(new H264Validator(frame_cb)); | 509 validator.reset(new H264Validator(frame_cb)); |
| 485 } else if (IsVP8(profile)) { | 510 } else if (IsVP8(profile)) { |
| 486 validator.reset(new VP8Validator(frame_cb)); | 511 validator.reset(new VP8Validator(frame_cb)); |
| 487 } else { | 512 } else { |
| 488 LOG(FATAL) << "Unsupported profile: " << profile; | 513 LOG(FATAL) << "Unsupported profile: " << profile; |
| 489 } | 514 } |
| 490 | 515 |
| 491 return validator.Pass(); | 516 return validator.Pass(); |
| 492 } | 517 } |
| 493 | 518 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 682 test_perf_(test_perf), | 707 test_perf_(test_perf), |
| 683 requested_bitrate_(0), | 708 requested_bitrate_(0), |
| 684 requested_framerate_(0), | 709 requested_framerate_(0), |
| 685 requested_subsequent_bitrate_(0), | 710 requested_subsequent_bitrate_(0), |
| 686 requested_subsequent_framerate_(0) { | 711 requested_subsequent_framerate_(0) { |
| 687 if (keyframe_period_) | 712 if (keyframe_period_) |
| 688 CHECK_LT(kMaxKeyframeDelay, keyframe_period_); | 713 CHECK_LT(kMaxKeyframeDelay, keyframe_period_); |
| 689 | 714 |
| 690 validator_ = StreamValidator::Create( | 715 validator_ = StreamValidator::Create( |
| 691 test_stream_->requested_profile, | 716 test_stream_->requested_profile, |
| 692 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this))); | 717 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this)), |
| 718 test_stream_->fake_encoder); | |
| 693 | 719 |
| 694 CHECK(validator_.get()); | 720 CHECK(validator_.get()); |
| 695 | 721 |
| 696 if (save_to_file_) { | 722 if (save_to_file_) { |
| 697 CHECK(!test_stream_->out_filename.empty()); | 723 CHECK(!test_stream_->out_filename.empty()); |
| 698 base::FilePath out_filename(test_stream_->out_filename); | 724 base::FilePath out_filename(test_stream_->out_filename); |
| 699 // This creates or truncates out_filename. | 725 // This creates or truncates out_filename. |
| 700 // Without it, AppendToFile() will not work. | 726 // Without it, AppendToFile() will not work. |
| 701 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); | 727 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); |
| 702 } | 728 } |
| 703 | 729 |
| 704 // Initialize the parameters of the test streams. | 730 // Initialize the parameters of the test streams. |
| 705 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch); | 731 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch); |
| 706 | 732 |
| 707 thread_checker_.DetachFromThread(); | 733 thread_checker_.DetachFromThread(); |
| 708 } | 734 } |
| 709 | 735 |
| 710 VEAClient::~VEAClient() { CHECK(!has_encoder()); } | 736 VEAClient::~VEAClient() { CHECK(!has_encoder()); } |
| 711 | 737 |
| 712 void VEAClient::CreateEncoder() { | 738 void VEAClient::CreateEncoder() { |
| 713 DCHECK(thread_checker_.CalledOnValidThread()); | 739 DCHECK(thread_checker_.CalledOnValidThread()); |
| 714 CHECK(!has_encoder()); | 740 CHECK(!has_encoder()); |
| 715 | 741 |
| 742 | |
| 743 if (test_stream_->fake_encoder) { | |
| 744 std::vector<uint32> no_stored_bitrates; | |
| 745 encoder_.reset( | |
| 746 new media::FakeVideoEncodeAccelerator( | |
| 747 scoped_refptr<base::SingleThreadTaskRunner>( | |
| 748 base::MessageLoopProxy::current()), | |
| 749 no_stored_bitrates)); | |
| 750 } else { | |
| 716 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 751 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 717 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 752 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
| 718 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); | 753 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); |
| 719 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 754 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 720 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); | 755 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); |
| 721 #endif | 756 #endif |
| 757 } | |
| 722 | 758 |
| 723 SetState(CS_ENCODER_SET); | 759 SetState(CS_ENCODER_SET); |
| 724 | 760 |
| 725 DVLOG(1) << "Profile: " << test_stream_->requested_profile | 761 DVLOG(1) << "Profile: " << test_stream_->requested_profile |
| 726 << ", initial bitrate: " << requested_bitrate_; | 762 << ", initial bitrate: " << requested_bitrate_; |
| 727 if (!encoder_->Initialize(kInputFormat, | 763 if (!encoder_->Initialize(kInputFormat, |
| 728 test_stream_->visible_size, | 764 test_stream_->visible_size, |
| 729 test_stream_->requested_profile, | 765 test_stream_->requested_profile, |
| 730 requested_bitrate_, | 766 requested_bitrate_, |
| 731 this)) { | 767 this)) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 base::SharedMemory* shm = it->second; | 881 base::SharedMemory* shm = it->second; |
| 846 output_buffers_at_client_.erase(it); | 882 output_buffers_at_client_.erase(it); |
| 847 | 883 |
| 848 if (state_ == CS_FINISHED) | 884 if (state_ == CS_FINISHED) |
| 849 return; | 885 return; |
| 850 | 886 |
| 851 encoded_stream_size_since_last_check_ += payload_size; | 887 encoded_stream_size_since_last_check_ += payload_size; |
| 852 | 888 |
| 853 const uint8* stream_ptr = static_cast<const uint8*>(shm->memory()); | 889 const uint8* stream_ptr = static_cast<const uint8*>(shm->memory()); |
| 854 if (payload_size > 0) { | 890 if (payload_size > 0) { |
| 855 validator_->ProcessStreamBuffer(stream_ptr, payload_size); | 891 validator_->ProcessStreamBuffer(stream_ptr, payload_size); |
|
wuchengli
2014/12/09 14:29:24
I think it's simpler to set |validator_| to NULL i
hellner1
2014/12/10 22:38:58
Good suggestion! Done.
| |
| 856 | 892 |
| 857 if (save_to_file_) { | 893 if (save_to_file_) { |
| 858 if (IsVP8(test_stream_->requested_profile)) | 894 if (IsVP8(test_stream_->requested_profile)) |
| 859 WriteIvfFrameHeader(num_encoded_frames_ - 1, payload_size); | 895 WriteIvfFrameHeader(num_encoded_frames_ - 1, payload_size); |
| 860 | 896 |
| 861 EXPECT_TRUE(base::AppendToFile( | 897 EXPECT_TRUE(base::AppendToFile( |
| 862 base::FilePath::FromUTF8Unsafe(test_stream_->out_filename), | 898 base::FilePath::FromUTF8Unsafe(test_stream_->out_filename), |
| 863 static_cast<char*>(shm->memory()), | 899 static_cast<char*>(shm->memory()), |
| 864 base::checked_cast<int>(payload_size))); | 900 base::checked_cast<int>(payload_size))); |
| 865 } | 901 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1275 } | 1311 } |
| 1276 | 1312 |
| 1277 content::g_env = | 1313 content::g_env = |
| 1278 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1314 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1279 testing::AddGlobalTestEnvironment( | 1315 testing::AddGlobalTestEnvironment( |
| 1280 new content::VideoEncodeAcceleratorTestEnvironment( | 1316 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1281 test_stream_data.Pass()))); | 1317 test_stream_data.Pass()))); |
| 1282 | 1318 |
| 1283 return RUN_ALL_TESTS(); | 1319 return RUN_ALL_TESTS(); |
| 1284 } | 1320 } |
| OLD | NEW |