• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 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 
11 #ifndef API_VIDEO_VIDEO_STREAM_DECODER_H_
12 #define API_VIDEO_VIDEO_STREAM_DECODER_H_
13 
14 #include <map>
15 #include <memory>
16 #include <utility>
17 
18 #include "api/units/time_delta.h"
19 #include "api/video/encoded_frame.h"
20 #include "api/video/video_frame.h"
21 #include "api/video_codecs/sdp_video_format.h"
22 #include "api/video_codecs/video_decoder_factory.h"
23 
24 namespace webrtc {
25 // NOTE: This class is still under development and may change without notice.
26 class VideoStreamDecoderInterface {
27  public:
28   class Callbacks {
29    public:
30     virtual ~Callbacks() = default;
31 
32     // Called when the VideoStreamDecoder enters a non-decodable state.
33     virtual void OnNonDecodableState() = 0;
34 
35     // Called with the last continuous frame.
36     virtual void OnContinuousUntil(
37         const video_coding::VideoLayerFrameId& key) = 0;
38 
39     // Called with the decoded frame.
40     virtual void OnDecodedFrame(VideoFrame decodedImage,
41                                 absl::optional<int> decode_time_ms,
42                                 absl::optional<int> qp) = 0;
43   };
44 
45   virtual ~VideoStreamDecoderInterface() = default;
46 
47   virtual void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) = 0;
48 
49   virtual void SetMinPlayoutDelay(TimeDelta min_delay) = 0;
50   virtual void SetMaxPlayoutDelay(TimeDelta max_delay) = 0;
51 };
52 
53 }  // namespace webrtc
54 
55 #endif  // API_VIDEO_VIDEO_STREAM_DECODER_H_
56