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

Side by Side Diff: webrtc/modules/video_coding/generic_decoder.h

Issue 2966823002: A few simplifications to CodecDatabase and VCMGenericDecoder (Closed)
Patch Set: Created 3 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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_MODULES_VIDEO_CODING_GENERIC_DECODER_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_
13 13
14 #include <memory>
15
14 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
15 #include "webrtc/base/thread_checker.h" 17 #include "webrtc/base/thread_checker.h"
16 #include "webrtc/modules/include/module_common_types.h" 18 #include "webrtc/modules/include/module_common_types.h"
17 #include "webrtc/modules/video_coding/encoded_frame.h" 19 #include "webrtc/modules/video_coding/encoded_frame.h"
18 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
19 #include "webrtc/modules/video_coding/timestamp_map.h" 21 #include "webrtc/modules/video_coding/timestamp_map.h"
20 #include "webrtc/modules/video_coding/timing.h" 22 #include "webrtc/modules/video_coding/timing.h"
21 23
22 namespace webrtc { 24 namespace webrtc {
23 25
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // from the same thread, and therfore a lock is not required to access it. 68 // from the same thread, and therfore a lock is not required to access it.
67 VCMReceiveCallback* _receiveCallback = nullptr; 69 VCMReceiveCallback* _receiveCallback = nullptr;
68 VCMTiming* _timing; 70 VCMTiming* _timing;
69 rtc::CriticalSection lock_; 71 rtc::CriticalSection lock_;
70 VCMTimestampMap _timestampMap GUARDED_BY(lock_); 72 VCMTimestampMap _timestampMap GUARDED_BY(lock_);
71 uint64_t _lastReceivedPictureID; 73 uint64_t _lastReceivedPictureID;
72 int64_t ntp_offset_; 74 int64_t ntp_offset_;
73 }; 75 };
74 76
75 class VCMGenericDecoder { 77 class VCMGenericDecoder {
76 friend class VCMCodecDataBase;
77
78 public: 78 public:
79 explicit VCMGenericDecoder(VideoDecoder* decoder, bool isExternal = false); 79 explicit VCMGenericDecoder(VideoDecoder* decoder, bool isExternal = false);
80 ~VCMGenericDecoder(); 80 ~VCMGenericDecoder();
81 81
82 /** 82 /**
83 * Initialize the decoder with the information from the VideoCodec 83 * Initialize the decoder with the information from the VideoCodec
84 */ 84 */
85 int32_t InitDecode(const VideoCodec* settings, int32_t numberOfCores); 85 int32_t InitDecode(const VideoCodec* settings, int32_t numberOfCores);
86 86
87 /** 87 /**
88 * Decode to a raw I420 frame, 88 * Decode to a raw I420 frame,
89 * 89 *
90 * inputVideoBuffer reference to encoded video frame 90 * inputVideoBuffer reference to encoded video frame
91 */ 91 */
92 int32_t Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs); 92 int32_t Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs);
93 93
94 /** 94 /**
95 * Free the decoder memory
96 */
97 int32_t Release();
98
99 /**
100 * Set decode callback. Deregistering while decoding is illegal. 95 * Set decode callback. Deregistering while decoding is illegal.
101 */ 96 */
102 int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback); 97 int32_t RegisterDecodeCompleteCallback(VCMDecodedFrameCallback* callback);
103 98
104 bool External() const; 99 bool External() const;
105 bool PrefersLateDecoding() const; 100 bool PrefersLateDecoding() const;
101 bool IsSameDecoder(VideoDecoder* decoder) const {
102 return decoder_.get() == decoder;
103 }
106 104
107 private: 105 private:
108 VCMDecodedFrameCallback* _callback; 106 VCMDecodedFrameCallback* _callback;
109 VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength]; 107 VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
110 uint32_t _nextFrameInfoIdx; 108 uint32_t _nextFrameInfoIdx;
111 VideoDecoder* const _decoder; 109 std::unique_ptr<VideoDecoder> decoder_;
112 VideoCodecType _codecType; 110 VideoCodecType _codecType;
113 bool _isExternal; 111 const bool _isExternal;
114 bool _keyFrameDecoded;
115 VideoContentType _last_keyframe_content_type; 112 VideoContentType _last_keyframe_content_type;
116 }; 113 };
117 114
118 } // namespace webrtc 115 } // namespace webrtc
119 116
120 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_ 117 #endif // WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codec_database.cc ('k') | webrtc/modules/video_coding/generic_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698