xref: /aosp_15_r20/external/webrtc/test/scenario/hardware_codecs.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "test/scenario/hardware_codecs.h"
11 
12 #include "rtc_base/checks.h"
13 
14 #ifdef WEBRTC_ANDROID
15 #include "modules/video_coding/codecs/test/android_codec_factory_helper.h"
16 #endif
17 #ifdef WEBRTC_MAC
18 #include "modules/video_coding/codecs/test/objc_codec_factory_helper.h"
19 #endif
20 
21 namespace webrtc {
22 namespace test {
CreateHardwareEncoderFactory()23 std::unique_ptr<VideoEncoderFactory> CreateHardwareEncoderFactory() {
24 #ifdef WEBRTC_ANDROID
25   InitializeAndroidObjects();
26   return CreateAndroidEncoderFactory();
27 #else
28 #ifdef WEBRTC_MAC
29   return CreateObjCEncoderFactory();
30 #else
31   RTC_DCHECK_NOTREACHED()
32       << "Hardware encoder not implemented on this platform.";
33   return nullptr;
34 #endif
35 #endif
36 }
CreateHardwareDecoderFactory()37 std::unique_ptr<VideoDecoderFactory> CreateHardwareDecoderFactory() {
38 #ifdef WEBRTC_ANDROID
39   InitializeAndroidObjects();
40   return CreateAndroidDecoderFactory();
41 #else
42 #ifdef WEBRTC_MAC
43   return CreateObjCDecoderFactory();
44 #else
45   RTC_DCHECK_NOTREACHED()
46       << "Hardware decoder not implemented on this platform.";
47   return nullptr;
48 #endif
49 #endif
50 }
51 }  // namespace test
52 }  // namespace webrtc
53