| 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 // Joint encoder and decoder testing. | 5 // Joint encoder and decoder testing. |
| 6 // These tests operate directly on the VP8 encoder and decoder, not the | 6 // These tests operate directly on the VP8 encoder and decoder, not the |
| 7 // transport layer, and are targeted at validating the bit stream. | 7 // transport layer, and are targeted at validating the bit stream. |
| 8 | 8 |
| 9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
| 10 #include <stdint.h> |
| 10 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
| 14 #include "media/cast/cast_environment.h" | 15 #include "media/cast/cast_environment.h" |
| 15 #include "media/cast/test/fake_single_thread_task_runner.h" | 16 #include "media/cast/test/fake_single_thread_task_runner.h" |
| 16 #include "media/cast/test/utility/video_utility.h" | 17 #include "media/cast/test/utility/video_utility.h" |
| 17 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" | 18 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" |
| 18 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" | 19 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 namespace cast { | 22 namespace cast { |
| 22 | 23 |
| 23 static const int64 kStartMillisecond = GG_INT64_C(1245); | 24 static const int64 kStartMillisecond = INT64_C(1245); |
| 24 static const int kWidth = 1280; | 25 static const int kWidth = 1280; |
| 25 static const int kHeight = 720; | 26 static const int kHeight = 720; |
| 26 static const int kStartbitrate = 4000000; | 27 static const int kStartbitrate = 4000000; |
| 27 static const int kMaxQp = 54; | 28 static const int kMaxQp = 54; |
| 28 static const int kMinQp = 4; | 29 static const int kMinQp = 4; |
| 29 static const int kMaxFrameRate = 30; | 30 static const int kMaxFrameRate = 30; |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 class EncodeDecodeTestFrameCallback | 33 class EncodeDecodeTestFrameCallback |
| 33 : public base::RefCountedThreadSafe<EncodeDecodeTestFrameCallback> { | 34 : public base::RefCountedThreadSafe<EncodeDecodeTestFrameCallback> { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 117 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
| 117 scoped_refptr<CastEnvironment> cast_environment_; | 118 scoped_refptr<CastEnvironment> cast_environment_; |
| 118 scoped_refptr<EncodeDecodeTestFrameCallback> test_callback_; | 119 scoped_refptr<EncodeDecodeTestFrameCallback> test_callback_; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 TEST_F(EncodeDecodeTest, BasicEncodeDecode) { | 122 TEST_F(EncodeDecodeTest, BasicEncodeDecode) { |
| 122 transport::EncodedVideoFrame encoded_frame; | 123 transport::EncodedVideoFrame encoded_frame; |
| 123 encoder_->Initialize(); | 124 encoder_->Initialize(); |
| 124 // Encode frame. | 125 // Encode frame. |
| 125 encoder_->Encode(video_frame_, &encoded_frame); | 126 encoder_->Encode(video_frame_, &encoded_frame); |
| 126 EXPECT_GT(encoded_frame.data.size(), GG_UINT64_C(0)); | 127 EXPECT_GT(encoded_frame.data.size(), UINT64_C(0)); |
| 127 // Decode frame. | 128 // Decode frame. |
| 128 decoder_->Decode(&encoded_frame, | 129 decoder_->Decode(&encoded_frame, |
| 129 base::TimeTicks(), | 130 base::TimeTicks(), |
| 130 base::Bind(&EncodeDecodeTestFrameCallback::DecodeComplete, | 131 base::Bind(&EncodeDecodeTestFrameCallback::DecodeComplete, |
| 131 test_callback_)); | 132 test_callback_)); |
| 132 task_runner_->RunTasks(); | 133 task_runner_->RunTasks(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace cast | 136 } // namespace cast |
| 136 } // namespace media | 137 } // namespace media |
| OLD | NEW |