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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void RunUntilIdle() { | 106 void RunUntilIdle() { |
107 DVLOG(3) << __func__; | 107 DVLOG(3) << __func__; |
108 encoder_thread_.task_runner()->PostTask( | 108 encoder_thread_.task_runner()->PostTask( |
109 FROM_HERE, base::Bind(&base::WaitableEvent::Signal, | 109 FROM_HERE, base::Bind(&base::WaitableEvent::Signal, |
110 base::Unretained(&idle_waiter_))); | 110 base::Unretained(&idle_waiter_))); |
111 idle_waiter_.Wait(); | 111 idle_waiter_.Wait(); |
112 } | 112 } |
113 | 113 |
114 void CreateEncoder(webrtc::VideoCodecType codec_type) { | 114 void CreateEncoder(webrtc::VideoCodecType codec_type) { |
115 DVLOG(3) << __func__; | 115 DVLOG(3) << __func__; |
116 rtc_encoder_ = base::MakeUnique<RTCVideoEncoder>(codec_type, | 116 media::VideoCodecProfile media_profile; |
| 117 switch (codec_type) { |
| 118 case webrtc::kVideoCodecVP8: |
| 119 media_profile = media::VP8PROFILE_ANY; |
| 120 break; |
| 121 case webrtc::kVideoCodecH264: |
| 122 media_profile = media::H264PROFILE_BASELINE; |
| 123 break; |
| 124 default: |
| 125 ADD_FAILURE() << "Unexpected codec type: " << codec_type; |
| 126 media_profile = media::VIDEO_CODEC_PROFILE_UNKNOWN; |
| 127 } |
| 128 rtc_encoder_ = base::MakeUnique<RTCVideoEncoder>(media_profile, |
117 mock_gpu_factories_.get()); | 129 mock_gpu_factories_.get()); |
118 } | 130 } |
119 | 131 |
120 // media::VideoEncodeAccelerator implementation. | 132 // media::VideoEncodeAccelerator implementation. |
121 bool Initialize(media::VideoPixelFormat input_format, | 133 bool Initialize(media::VideoPixelFormat input_format, |
122 const gfx::Size& input_visible_size, | 134 const gfx::Size& input_visible_size, |
123 media::VideoCodecProfile output_profile, | 135 media::VideoCodecProfile output_profile, |
124 uint32_t initial_bitrate, | 136 uint32_t initial_bitrate, |
125 media::VideoEncodeAccelerator::Client* client) { | 137 media::VideoEncodeAccelerator::Client* client) { |
126 DVLOG(3) << __func__; | 138 DVLOG(3) << __func__; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 rtc_frame.set_ntp_time_ms(4567891); | 283 rtc_frame.set_ntp_time_ms(4567891); |
272 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 284 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
273 rtc_encoder_->Encode(rtc_frame, nullptr, &frame_types)); | 285 rtc_encoder_->Encode(rtc_frame, nullptr, &frame_types)); |
274 } | 286 } |
275 | 287 |
276 INSTANTIATE_TEST_CASE_P(CodecProfiles, | 288 INSTANTIATE_TEST_CASE_P(CodecProfiles, |
277 RTCVideoEncoderTest, | 289 RTCVideoEncoderTest, |
278 Values(webrtc::kVideoCodecVP8, | 290 Values(webrtc::kVideoCodecVP8, |
279 webrtc::kVideoCodecH264)); | 291 webrtc::kVideoCodecH264)); |
280 } // namespace content | 292 } // namespace content |
OLD | NEW |