blob: 849a054a0476e6604ed81139db857709ac6bccd0 [file] [log] [blame]
Danil Chapovalovb703db92019-04-08 16:59:28 +02001/*
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
17namespace webrtc {
18namespace {
19
20class NullCallbacks : public VideoStreamDecoderInterface::Callbacks {
21 public:
22 ~NullCallbacks() override = default;
23 void OnNonDecodableState() override {}
philipela028a1a2020-09-11 16:05:56 +020024 void OnDecodedFrame(VideoFrame frame,
25 const VideoStreamDecoderInterface::Callbacks::FrameInfo&
26 frame_info) override {}
Danil Chapovalovb703db92019-04-08 16:59:28 +020027};
28
29TEST(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