blob: 7b142a90b982f52eb67d5fb26b397a270672fad0 [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 {}
24 void OnContinuousUntil(const video_coding::VideoLayerFrameId& key) override {}
25 void OnDecodedFrame(VideoFrame decodedImage,
26 absl::optional<int> decode_time_ms,
27 absl::optional<int> qp) override {}
28};
29
30TEST(VideoStreamDecoderCreate, CreateVideoStreamDecoder) {
31 std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings = {
32 {/*payload_type=*/111, {SdpVideoFormat("VP8"), /*number_of_cores=*/2}}};
33 NullCallbacks callbacks;
34 std::unique_ptr<VideoDecoderFactory> decoder_factory =
35 CreateBuiltinVideoDecoderFactory();
36
37 std::unique_ptr<TaskQueueFactory> task_queue_factory =
38 CreateDefaultTaskQueueFactory();
39
40 std::unique_ptr<VideoStreamDecoderInterface> decoder =
41 CreateVideoStreamDecoder(&callbacks, decoder_factory.get(),
42 task_queue_factory.get(), decoder_settings);
43 EXPECT_TRUE(decoder);
44}
45
46} // namespace
47} // namespace webrtc