OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void RunUntilIdle() { | 82 void RunUntilIdle() { |
83 DVLOG(3) << __FUNCTION__; | 83 DVLOG(3) << __FUNCTION__; |
84 encoder_thread_.task_runner()->PostTask( | 84 encoder_thread_.task_runner()->PostTask( |
85 FROM_HERE, base::Bind(&base::WaitableEvent::Signal, | 85 FROM_HERE, base::Bind(&base::WaitableEvent::Signal, |
86 base::Unretained(&idle_waiter_))); | 86 base::Unretained(&idle_waiter_))); |
87 idle_waiter_.Wait(); | 87 idle_waiter_.Wait(); |
88 } | 88 } |
89 | 89 |
90 void CreateEncoder(webrtc::VideoCodecType codec_type) { | 90 void CreateEncoder(webrtc::VideoCodecType codec_type) { |
91 DVLOG(3) << __FUNCTION__; | 91 DVLOG(3) << __FUNCTION__; |
92 rtc_encoder_ = base::MakeUnique<RTCVideoEncoder>(codec_type, | 92 media::VideoCodecProfile media_profile; |
| 93 switch (codec_type) { |
| 94 case webrtc::kVideoCodecVP8: |
| 95 media_profile = media::VP8PROFILE_ANY; |
| 96 break; |
| 97 case webrtc::kVideoCodecH264: |
| 98 media_profile = media::H264PROFILE_BASELINE; |
| 99 break; |
| 100 default: |
| 101 ADD_FAILURE() << "Unexpected codec type: " << codec_type; |
| 102 media_profile = media::VIDEO_CODEC_PROFILE_UNKNOWN; |
| 103 } |
| 104 rtc_encoder_ = base::MakeUnique<RTCVideoEncoder>(media_profile, |
93 mock_gpu_factories_.get()); | 105 mock_gpu_factories_.get()); |
94 } | 106 } |
95 | 107 |
96 // media::VideoEncodeAccelerator implementation. | 108 // media::VideoEncodeAccelerator implementation. |
97 bool Initialize(media::VideoPixelFormat input_format, | 109 bool Initialize(media::VideoPixelFormat input_format, |
98 const gfx::Size& input_visible_size, | 110 const gfx::Size& input_visible_size, |
99 media::VideoCodecProfile output_profile, | 111 media::VideoCodecProfile output_profile, |
100 uint32_t initial_bitrate, | 112 uint32_t initial_bitrate, |
101 media::VideoEncodeAccelerator::Client* client) { | 113 media::VideoEncodeAccelerator::Client* client) { |
102 DVLOG(3) << __FUNCTION__; | 114 DVLOG(3) << __FUNCTION__; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 rtc_encoder_->Encode(webrtc::VideoFrame(upscaled_buffer, 0, 0, | 203 rtc_encoder_->Encode(webrtc::VideoFrame(upscaled_buffer, 0, 0, |
192 webrtc::kVideoRotation_0), | 204 webrtc::kVideoRotation_0), |
193 nullptr, &frame_types)); | 205 nullptr, &frame_types)); |
194 } | 206 } |
195 | 207 |
196 INSTANTIATE_TEST_CASE_P(CodecProfiles, | 208 INSTANTIATE_TEST_CASE_P(CodecProfiles, |
197 RTCVideoEncoderTest, | 209 RTCVideoEncoderTest, |
198 Values(webrtc::kVideoCodecVP8, | 210 Values(webrtc::kVideoCodecVP8, |
199 webrtc::kVideoCodecH264)); | 211 webrtc::kVideoCodecH264)); |
200 } // namespace content | 212 } // namespace content |
OLD | NEW |