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 media::VideoCodecProfile media_profile; | 92 rtc_encoder_ = base::MakeUnique<RTCVideoEncoder>(codec_type, |
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, | |
105 mock_gpu_factories_.get()); | 93 mock_gpu_factories_.get()); |
106 } | 94 } |
107 | 95 |
108 // media::VideoEncodeAccelerator implementation. | 96 // media::VideoEncodeAccelerator implementation. |
109 bool Initialize(media::VideoPixelFormat input_format, | 97 bool Initialize(media::VideoPixelFormat input_format, |
110 const gfx::Size& input_visible_size, | 98 const gfx::Size& input_visible_size, |
111 media::VideoCodecProfile output_profile, | 99 media::VideoCodecProfile output_profile, |
112 uint32_t initial_bitrate, | 100 uint32_t initial_bitrate, |
113 media::VideoEncodeAccelerator::Client* client) { | 101 media::VideoEncodeAccelerator::Client* client) { |
114 DVLOG(3) << __FUNCTION__; | 102 DVLOG(3) << __FUNCTION__; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 rtc_encoder_->Encode(webrtc::VideoFrame(upscaled_buffer, 0, 0, | 191 rtc_encoder_->Encode(webrtc::VideoFrame(upscaled_buffer, 0, 0, |
204 webrtc::kVideoRotation_0), | 192 webrtc::kVideoRotation_0), |
205 nullptr, &frame_types)); | 193 nullptr, &frame_types)); |
206 } | 194 } |
207 | 195 |
208 INSTANTIATE_TEST_CASE_P(CodecProfiles, | 196 INSTANTIATE_TEST_CASE_P(CodecProfiles, |
209 RTCVideoEncoderTest, | 197 RTCVideoEncoderTest, |
210 Values(webrtc::kVideoCodecVP8, | 198 Values(webrtc::kVideoCodecVP8, |
211 webrtc::kVideoCodecH264)); | 199 webrtc::kVideoCodecH264)); |
212 } // namespace content | 200 } // namespace content |
OLD | NEW |