| 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 "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" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 }; | 347 }; |
| 348 | 348 |
| 349 class H264Validator : public StreamValidator { | 349 class H264Validator : public StreamValidator { |
| 350 public: | 350 public: |
| 351 explicit H264Validator(const FrameFoundCallback& frame_cb) | 351 explicit H264Validator(const FrameFoundCallback& frame_cb) |
| 352 : StreamValidator(frame_cb), | 352 : StreamValidator(frame_cb), |
| 353 seen_sps_(false), | 353 seen_sps_(false), |
| 354 seen_pps_(false), | 354 seen_pps_(false), |
| 355 seen_idr_(false) {} | 355 seen_idr_(false) {} |
| 356 | 356 |
| 357 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) OVERRIDE; | 357 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) override; |
| 358 | 358 |
| 359 private: | 359 private: |
| 360 // Set to true when encoder provides us with the corresponding NALU type. | 360 // Set to true when encoder provides us with the corresponding NALU type. |
| 361 bool seen_sps_; | 361 bool seen_sps_; |
| 362 bool seen_pps_; | 362 bool seen_pps_; |
| 363 bool seen_idr_; | 363 bool seen_idr_; |
| 364 | 364 |
| 365 media::H264Parser h264_parser_; | 365 media::H264Parser h264_parser_; |
| 366 }; | 366 }; |
| 367 | 367 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 class VP8Validator : public StreamValidator { | 423 class VP8Validator : public StreamValidator { |
| 424 public: | 424 public: |
| 425 explicit VP8Validator(const FrameFoundCallback& frame_cb) | 425 explicit VP8Validator(const FrameFoundCallback& frame_cb) |
| 426 : StreamValidator(frame_cb), | 426 : StreamValidator(frame_cb), |
| 427 seen_keyframe_(false) {} | 427 seen_keyframe_(false) {} |
| 428 | 428 |
| 429 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) OVERRIDE; | 429 virtual void ProcessStreamBuffer(const uint8* stream, size_t size) override; |
| 430 | 430 |
| 431 private: | 431 private: |
| 432 // Have we already got a keyframe in the stream? | 432 // Have we already got a keyframe in the stream? |
| 433 bool seen_keyframe_; | 433 bool seen_keyframe_; |
| 434 }; | 434 }; |
| 435 | 435 |
| 436 void VP8Validator::ProcessStreamBuffer(const uint8* stream, size_t size) { | 436 void VP8Validator::ProcessStreamBuffer(const uint8* stream, size_t size) { |
| 437 bool keyframe = !(stream[0] & 0x01); | 437 bool keyframe = !(stream[0] & 0x01); |
| 438 if (keyframe) | 438 if (keyframe) |
| 439 seen_keyframe_ = true; | 439 seen_keyframe_ = true; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 virtual ~VEAClient(); | 478 virtual ~VEAClient(); |
| 479 void CreateEncoder(); | 479 void CreateEncoder(); |
| 480 void DestroyEncoder(); | 480 void DestroyEncoder(); |
| 481 | 481 |
| 482 // Return the number of encoded frames per second. | 482 // Return the number of encoded frames per second. |
| 483 double frames_per_second(); | 483 double frames_per_second(); |
| 484 | 484 |
| 485 // VideoDecodeAccelerator::Client implementation. | 485 // VideoDecodeAccelerator::Client implementation. |
| 486 virtual void RequireBitstreamBuffers(unsigned int input_count, | 486 virtual void RequireBitstreamBuffers(unsigned int input_count, |
| 487 const gfx::Size& input_coded_size, | 487 const gfx::Size& input_coded_size, |
| 488 size_t output_buffer_size) OVERRIDE; | 488 size_t output_buffer_size) override; |
| 489 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, | 489 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, |
| 490 size_t payload_size, | 490 size_t payload_size, |
| 491 bool key_frame) OVERRIDE; | 491 bool key_frame) override; |
| 492 virtual void NotifyError(VideoEncodeAccelerator::Error error) OVERRIDE; | 492 virtual void NotifyError(VideoEncodeAccelerator::Error error) override; |
| 493 | 493 |
| 494 private: | 494 private: |
| 495 bool has_encoder() { return encoder_.get(); } | 495 bool has_encoder() { return encoder_.get(); } |
| 496 | 496 |
| 497 void SetState(ClientState new_state); | 497 void SetState(ClientState new_state); |
| 498 | 498 |
| 499 // Set current stream parameters to given |bitrate| at |framerate|. | 499 // Set current stream parameters to given |bitrate| at |framerate|. |
| 500 void SetStreamParameters(unsigned int bitrate, unsigned int framerate); | 500 void SetStreamParameters(unsigned int bitrate, unsigned int framerate); |
| 501 | 501 |
| 502 // Called when encoder is done with a VideoFrame. | 502 // Called when encoder is done with a VideoFrame. |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 content::g_env = | 1206 content::g_env = |
| 1207 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1207 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1208 testing::AddGlobalTestEnvironment( | 1208 testing::AddGlobalTestEnvironment( |
| 1209 new content::VideoEncodeAcceleratorTestEnvironment( | 1209 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1210 test_stream_data.Pass()))); | 1210 test_stream_data.Pass()))); |
| 1211 | 1211 |
| 1212 return RUN_ALL_TESTS(); | 1212 return RUN_ALL_TESTS(); |
| 1213 } | 1213 } |
| OLD | NEW |