1 /*
2 * Copyright (c) 2019 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
11 #include "api/video/video_stream_decoder_create.h"
12
13 #include "api/task_queue/default_task_queue_factory.h"
14 #include "api/video_codecs/builtin_video_decoder_factory.h"
15 #include "test/gtest.h"
16
17 namespace webrtc {
18 namespace {
19
20 class NullCallbacks : public VideoStreamDecoderInterface::Callbacks {
21 public:
22 ~NullCallbacks() override = default;
OnNonDecodableState()23 void OnNonDecodableState() override {}
OnDecodedFrame(VideoFrame frame,const VideoStreamDecoderInterface::Callbacks::FrameInfo & frame_info)24 void OnDecodedFrame(VideoFrame frame,
25 const VideoStreamDecoderInterface::Callbacks::FrameInfo&
26 frame_info) override {}
27 };
28
TEST(VideoStreamDecoderCreate,CreateVideoStreamDecoder)29 TEST(VideoStreamDecoderCreate, CreateVideoStreamDecoder) {
30 std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings = {
31 {/*payload_type=*/111, {SdpVideoFormat("VP8"), /*number_of_cores=*/2}}};
32 NullCallbacks callbacks;
33 std::unique_ptr<VideoDecoderFactory> decoder_factory =
34 CreateBuiltinVideoDecoderFactory();
35
36 std::unique_ptr<TaskQueueFactory> task_queue_factory =
37 CreateDefaultTaskQueueFactory();
38
39 std::unique_ptr<VideoStreamDecoderInterface> decoder =
40 CreateVideoStreamDecoder(&callbacks, decoder_factory.get(),
41 task_queue_factory.get(), decoder_settings);
42 EXPECT_TRUE(decoder);
43 }
44
45 } // namespace
46 } // namespace webrtc
47