Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: webrtc/media/engine/videodecodersoftwarefallbackwrapper.h

Issue 2518263003: Move VideoDecoderSoftwareFallbackWrapper from webrtc/video_decoder.h to webrtc/media/engine/ (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/media/BUILD.gn ('k') | webrtc/media/engine/videodecodersoftwarefallbackwrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_VIDEO_DECODER_H_ 11 #ifndef WEBRTC_MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
12 #define WEBRTC_VIDEO_DECODER_H_ 12 #define WEBRTC_MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector>
17 16
18 #include "webrtc/common_types.h" 17 #include "webrtc/video_decoder.h"
19 #include "webrtc/typedefs.h"
20 #include "webrtc/video_frame.h"
21 18
22 namespace webrtc { 19 namespace webrtc {
23 20
24 class RTPFragmentationHeader;
25 // TODO(pbos): Expose these through a public (root) header or change these APIs.
26 struct CodecSpecificInfo;
27 class VideoCodec;
28
29 class DecodedImageCallback {
30 public:
31 virtual ~DecodedImageCallback() {}
32
33 virtual int32_t Decoded(VideoFrame& decodedImage) = 0;
34 // Provides an alternative interface that allows the decoder to specify the
35 // decode time excluding waiting time for any previous pending frame to
36 // return. This is necessary for breaking positive feedback in the delay
37 // estimation when the decoder has a single output buffer.
38 // TODO(perkj): Remove default implementation when chromium has been updated.
39 virtual int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) {
40 // The default implementation ignores custom decode time value.
41 return Decoded(decodedImage);
42 }
43
44 virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
45 return -1;
46 }
47
48 virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; }
49 };
50
51 class VideoDecoder {
52 public:
53 enum DecoderType {
54 kH264,
55 kVp8,
56 kVp9,
57 kUnsupportedCodec,
58 };
59
60 static VideoDecoder* Create(DecoderType codec_type);
61
62 virtual ~VideoDecoder() {}
63
64 virtual int32_t InitDecode(const VideoCodec* codec_settings,
65 int32_t number_of_cores) = 0;
66
67 virtual int32_t Decode(const EncodedImage& input_image,
68 bool missing_frames,
69 const RTPFragmentationHeader* fragmentation,
70 const CodecSpecificInfo* codec_specific_info = NULL,
71 int64_t render_time_ms = -1) = 0;
72
73 virtual int32_t RegisterDecodeCompleteCallback(
74 DecodedImageCallback* callback) = 0;
75
76 virtual int32_t Release() = 0;
77
78 // Returns true if the decoder prefer to decode frames late.
79 // That is, it can not decode infinite number of frames before the decoded
80 // frame is consumed.
81 virtual bool PrefersLateDecoding() const { return true; }
82
83 virtual const char* ImplementationName() const { return "unknown"; }
84 };
85
86 // Class used to wrap external VideoDecoders to provide a fallback option on 21 // Class used to wrap external VideoDecoders to provide a fallback option on
87 // software decoding when a hardware decoder fails to decode a stream due to 22 // software decoding when a hardware decoder fails to decode a stream due to
88 // hardware restrictions, such as max resolution. 23 // hardware restrictions, such as max resolution.
89 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { 24 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder {
90 public: 25 public:
91 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, 26 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type,
92 VideoDecoder* decoder); 27 VideoDecoder* decoder);
93 28
94 int32_t InitDecode(const VideoCodec* codec_settings, 29 int32_t InitDecode(const VideoCodec* codec_settings,
95 int32_t number_of_cores) override; 30 int32_t number_of_cores) override;
(...skipping 18 matching lines...) Expand all
114 const DecoderType decoder_type_; 49 const DecoderType decoder_type_;
115 VideoDecoder* const decoder_; 50 VideoDecoder* const decoder_;
116 51
117 VideoCodec codec_settings_; 52 VideoCodec codec_settings_;
118 int32_t number_of_cores_; 53 int32_t number_of_cores_;
119 std::string fallback_implementation_name_; 54 std::string fallback_implementation_name_;
120 std::unique_ptr<VideoDecoder> fallback_decoder_; 55 std::unique_ptr<VideoDecoder> fallback_decoder_;
121 DecodedImageCallback* callback_; 56 DecodedImageCallback* callback_;
122 }; 57 };
123 58
124 // Video decoder class to be used for unknown codecs. Doesn't support decoding
125 // but logs messages to LS_ERROR.
126 class NullVideoDecoder : public VideoDecoder {
127 public:
128 NullVideoDecoder();
129
130 int32_t InitDecode(const VideoCodec* codec_settings,
131 int32_t number_of_cores) override;
132
133 int32_t Decode(const EncodedImage& input_image,
134 bool missing_frames,
135 const RTPFragmentationHeader* fragmentation,
136 const CodecSpecificInfo* codec_specific_info,
137 int64_t render_time_ms) override;
138
139 int32_t RegisterDecodeCompleteCallback(
140 DecodedImageCallback* callback) override;
141
142 int32_t Release() override;
143
144 const char* ImplementationName() const override;
145 };
146
147 } // namespace webrtc 59 } // namespace webrtc
148 60
149 #endif // WEBRTC_VIDEO_DECODER_H_ 61 #endif // WEBRTC_MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
OLDNEW
« no previous file with comments | « webrtc/media/BUILD.gn ('k') | webrtc/media/engine/videodecodersoftwarefallbackwrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698