Chromium Code Reviews

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

Issue 1406903002: Expose codec implementation names in stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove conflict marker Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 #include "webrtc/base/logging.h" 11 #include "webrtc/base/logging.h"
12 #include "webrtc/base/trace_event.h" 12 #include "webrtc/base/trace_event.h"
13 #include "webrtc/modules/video_coding/include/video_coding.h" 13 #include "webrtc/modules/video_coding/include/video_coding.h"
14 #include "webrtc/modules/video_coding/generic_decoder.h" 14 #include "webrtc/modules/video_coding/generic_decoder.h"
15 #include "webrtc/modules/video_coding/internal_defines.h" 15 #include "webrtc/modules/video_coding/internal_defines.h"
16 #include "webrtc/system_wrappers/include/clock.h" 16 #include "webrtc/system_wrappers/include/clock.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing, 20 VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing,
21 Clock* clock) 21 Clock* clock)
22 : 22 : _critSect(CriticalSectionWrapper::CreateCriticalSection()),
23 _critSect(CriticalSectionWrapper::CreateCriticalSection()), 23 _clock(clock),
24 _clock(clock), 24 _receiveCallback(NULL),
25 _receiveCallback(NULL), 25 _timing(timing),
26 _timing(timing), 26 _timestampMap(kDecoderFrameMemoryLength),
27 _timestampMap(kDecoderFrameMemoryLength), 27 _lastReceivedPictureID(0) {}
28 _lastReceivedPictureID(0)
29 {
30 }
31 28
32 VCMDecodedFrameCallback::~VCMDecodedFrameCallback() 29 VCMDecodedFrameCallback::~VCMDecodedFrameCallback()
33 { 30 {
34 delete _critSect; 31 delete _critSect;
35 } 32 }
36 33
37 void VCMDecodedFrameCallback::SetUserReceiveCallback( 34 void VCMDecodedFrameCallback::SetUserReceiveCallback(
38 VCMReceiveCallback* receiveCallback) 35 VCMReceiveCallback* receiveCallback)
39 { 36 {
40 CriticalSectionScoped cs(_critSect); 37 CriticalSectionScoped cs(_critSect);
(...skipping 67 matching lines...)
108 { 105 {
109 _lastReceivedPictureID = pictureId; 106 _lastReceivedPictureID = pictureId;
110 return 0; 107 return 0;
111 } 108 }
112 109
113 uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const 110 uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const
114 { 111 {
115 return _lastReceivedPictureID; 112 return _lastReceivedPictureID;
116 } 113 }
117 114
115 void VCMDecodedFrameCallback::OnDecoderImplementationName(
116 const char* implementation_name) {
117 CriticalSectionScoped cs(_critSect);
118 if (_receiveCallback)
119 _receiveCallback->OnDecoderImplementationName(implementation_name);
120 }
121
118 void VCMDecodedFrameCallback::Map(uint32_t timestamp, 122 void VCMDecodedFrameCallback::Map(uint32_t timestamp,
119 VCMFrameInformation* frameInfo) { 123 VCMFrameInformation* frameInfo) {
120 CriticalSectionScoped cs(_critSect); 124 CriticalSectionScoped cs(_critSect);
121 _timestampMap.Add(timestamp, frameInfo); 125 _timestampMap.Add(timestamp, frameInfo);
122 } 126 }
123 127
124 int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) 128 int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp)
125 { 129 {
126 CriticalSectionScoped cs(_critSect); 130 CriticalSectionScoped cs(_critSect);
127 if (_timestampMap.Pop(timestamp) == NULL) 131 if (_timestampMap.Pop(timestamp) == NULL)
(...skipping 36 matching lines...)
164 _frameInfos[_nextFrameInfoIdx].rotation = frame.rotation(); 168 _frameInfos[_nextFrameInfoIdx].rotation = frame.rotation();
165 _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]); 169 _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
166 170
167 _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; 171 _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
168 int32_t ret = _decoder.Decode(frame.EncodedImage(), 172 int32_t ret = _decoder.Decode(frame.EncodedImage(),
169 frame.MissingFrame(), 173 frame.MissingFrame(),
170 frame.FragmentationHeader(), 174 frame.FragmentationHeader(),
171 frame.CodecSpecific(), 175 frame.CodecSpecific(),
172 frame.RenderTimeMs()); 176 frame.RenderTimeMs());
173 177
178 _callback->OnDecoderImplementationName(_decoder.ImplementationName());
174 if (ret < WEBRTC_VIDEO_CODEC_OK) 179 if (ret < WEBRTC_VIDEO_CODEC_OK)
175 { 180 {
176 LOG(LS_WARNING) << "Failed to decode frame with timestamp " 181 LOG(LS_WARNING) << "Failed to decode frame with timestamp "
177 << frame.TimeStamp() << ", error code: " << ret; 182 << frame.TimeStamp() << ", error code: " << ret;
178 _callback->Pop(frame.TimeStamp()); 183 _callback->Pop(frame.TimeStamp());
179 return ret; 184 return ret;
180 } 185 }
181 else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT || 186 else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT ||
182 ret == WEBRTC_VIDEO_CODEC_REQUEST_SLI) 187 ret == WEBRTC_VIDEO_CODEC_REQUEST_SLI)
183 { 188 {
(...skipping 19 matching lines...)
203 _callback = callback; 208 _callback = callback;
204 return _decoder.RegisterDecodeCompleteCallback(callback); 209 return _decoder.RegisterDecodeCompleteCallback(callback);
205 } 210 }
206 211
207 bool VCMGenericDecoder::External() const 212 bool VCMGenericDecoder::External() const
208 { 213 {
209 return _isExternal; 214 return _isExternal;
210 } 215 }
211 216
212 } // namespace 217 } // namespace
OLDNEW

Powered by Google App Engine