• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {}
OnContinuousUntil(const video_coding::VideoLayerFrameId & key)24   void OnContinuousUntil(const video_coding::VideoLayerFrameId& key) override {}
OnDecodedFrame(VideoFrame decodedImage,absl::optional<int> decode_time_ms,absl::optional<int> qp)25   void OnDecodedFrame(VideoFrame decodedImage,
26                       absl::optional<int> decode_time_ms,
27                       absl::optional<int> qp) override {}
28 };
29 
TEST(VideoStreamDecoderCreate,CreateVideoStreamDecoder)30 TEST(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
48