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

Side by Side Diff: webrtc/video_decoder.h

Issue 2521203002: Move VideoDecoder::Create() logic to separate internal video decoder factory (Closed)
Patch Set: Add unittest 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/video/video_decoder.cc ('k') | no next file » | 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) 2014 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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { 44 virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) {
45 return -1; 45 return -1;
46 } 46 }
47 47
48 virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; } 48 virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; }
49 }; 49 };
50 50
51 class VideoDecoder { 51 class VideoDecoder {
52 public: 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() {} 53 virtual ~VideoDecoder() {}
63 54
64 virtual int32_t InitDecode(const VideoCodec* codec_settings, 55 virtual int32_t InitDecode(const VideoCodec* codec_settings,
65 int32_t number_of_cores) = 0; 56 int32_t number_of_cores) = 0;
66 57
67 virtual int32_t Decode(const EncodedImage& input_image, 58 virtual int32_t Decode(const EncodedImage& input_image,
68 bool missing_frames, 59 bool missing_frames,
69 const RTPFragmentationHeader* fragmentation, 60 const RTPFragmentationHeader* fragmentation,
70 const CodecSpecificInfo* codec_specific_info = NULL, 61 const CodecSpecificInfo* codec_specific_info = NULL,
71 int64_t render_time_ms = -1) = 0; 62 int64_t render_time_ms = -1) = 0;
72 63
73 virtual int32_t RegisterDecodeCompleteCallback( 64 virtual int32_t RegisterDecodeCompleteCallback(
74 DecodedImageCallback* callback) = 0; 65 DecodedImageCallback* callback) = 0;
75 66
76 virtual int32_t Release() = 0; 67 virtual int32_t Release() = 0;
77 68
78 // Returns true if the decoder prefer to decode frames late. 69 // Returns true if the decoder prefer to decode frames late.
79 // That is, it can not decode infinite number of frames before the decoded 70 // That is, it can not decode infinite number of frames before the decoded
80 // frame is consumed. 71 // frame is consumed.
81 virtual bool PrefersLateDecoding() const { return true; } 72 virtual bool PrefersLateDecoding() const { return true; }
82 73
83 virtual const char* ImplementationName() const { return "unknown"; } 74 virtual const char* ImplementationName() const { return "unknown"; }
84 }; 75 };
85 76
86 // Video decoder class to be used for unknown codecs. Doesn't support decoding
87 // but logs messages to LS_ERROR.
88 class NullVideoDecoder : public VideoDecoder {
89 public:
90 NullVideoDecoder();
91
92 int32_t InitDecode(const VideoCodec* codec_settings,
93 int32_t number_of_cores) override;
94
95 int32_t Decode(const EncodedImage& input_image,
96 bool missing_frames,
97 const RTPFragmentationHeader* fragmentation,
98 const CodecSpecificInfo* codec_specific_info,
99 int64_t render_time_ms) override;
100
101 int32_t RegisterDecodeCompleteCallback(
102 DecodedImageCallback* callback) override;
103
104 int32_t Release() override;
105
106 const char* ImplementationName() const override;
107 };
108
109 } // namespace webrtc 77 } // namespace webrtc
110 78
111 #endif // WEBRTC_VIDEO_DECODER_H_ 79 #endif // WEBRTC_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « webrtc/video/video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698