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

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

Issue 2649133005: Add QP sum stats for received streams. (Closed)
Patch Set: Rebase. Created 3 years, 10 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
(...skipping 30 matching lines...) Expand all
41 CriticalSectionScoped cs(_critSect); 41 CriticalSectionScoped cs(_critSect);
42 return _receiveCallback; 42 return _receiveCallback;
43 } 43 }
44 44
45 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) { 45 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
46 return Decoded(decodedImage, -1); 46 return Decoded(decodedImage, -1);
47 } 47 }
48 48
49 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, 49 int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
50 int64_t decode_time_ms) { 50 int64_t decode_time_ms) {
51 Decoded(decodedImage,
52 decode_time_ms >= 0 ? rtc::Optional<int32_t>(decode_time_ms)
53 : rtc::Optional<int32_t>(),
54 rtc::Optional<uint8_t>());
55 return WEBRTC_VIDEO_CODEC_OK;
56 }
57
58 void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
59 rtc::Optional<int32_t> decode_time_ms,
60 rtc::Optional<uint8_t> qp) {
51 TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded", 61 TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
52 "timestamp", decodedImage.timestamp()); 62 "timestamp", decodedImage.timestamp());
53 // TODO(holmer): We should improve this so that we can handle multiple 63 // TODO(holmer): We should improve this so that we can handle multiple
54 // callbacks from one call to Decode(). 64 // callbacks from one call to Decode().
55 VCMFrameInformation* frameInfo; 65 VCMFrameInformation* frameInfo;
56 VCMReceiveCallback* callback; 66 VCMReceiveCallback* callback;
57 { 67 {
58 CriticalSectionScoped cs(_critSect); 68 CriticalSectionScoped cs(_critSect);
59 frameInfo = _timestampMap.Pop(decodedImage.timestamp()); 69 frameInfo = _timestampMap.Pop(decodedImage.timestamp());
60 callback = _receiveCallback; 70 callback = _receiveCallback;
61 } 71 }
62 72
63 if (frameInfo == NULL) { 73 if (frameInfo == NULL) {
64 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping " 74 LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping "
65 "this one."; 75 "this one.";
66 return WEBRTC_VIDEO_CODEC_OK; 76 return;
67 } 77 }
68 78
69 const int64_t now_ms = _clock->TimeInMilliseconds(); 79 const int64_t now_ms = _clock->TimeInMilliseconds();
70 if (decode_time_ms < 0) { 80 if (!decode_time_ms) {
71 decode_time_ms = 81 decode_time_ms =
72 static_cast<int32_t>(now_ms - frameInfo->decodeStartTimeMs); 82 rtc::Optional<int32_t>(now_ms - frameInfo->decodeStartTimeMs);
73 } 83 }
74 _timing->StopDecodeTimer(decodedImage.timestamp(), decode_time_ms, now_ms, 84 _timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms,
75 frameInfo->renderTimeMs); 85 frameInfo->renderTimeMs);
76 86
77 decodedImage.set_timestamp_us( 87 decodedImage.set_timestamp_us(
78 frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec); 88 frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec);
79 decodedImage.set_rotation(frameInfo->rotation); 89 decodedImage.set_rotation(frameInfo->rotation);
80 // TODO(sakal): Investigate why callback is NULL sometimes and replace if 90 // TODO(sakal): Investigate why callback is NULL sometimes and replace if
81 // statement with a DCHECK. 91 // statement with a DCHECK.
82 if (callback) { 92 if (callback) {
83 callback->FrameToRender(decodedImage); 93 callback->FrameToRender(decodedImage, qp);
84 } else { 94 } else {
85 LOG(LS_WARNING) << "No callback, dropping frame."; 95 LOG(LS_WARNING) << "No callback, dropping frame.";
86 } 96 }
87 return WEBRTC_VIDEO_CODEC_OK;
88 } 97 }
89 98
90 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( 99 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
91 const uint64_t pictureId) { 100 const uint64_t pictureId) {
92 CriticalSectionScoped cs(_critSect); 101 CriticalSectionScoped cs(_critSect);
93 if (_receiveCallback != NULL) { 102 if (_receiveCallback != NULL) {
94 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); 103 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId);
95 } 104 }
96 return -1; 105 return -1;
97 } 106 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 195
187 bool VCMGenericDecoder::External() const { 196 bool VCMGenericDecoder::External() const {
188 return _isExternal; 197 return _isExternal;
189 } 198 }
190 199
191 bool VCMGenericDecoder::PrefersLateDecoding() const { 200 bool VCMGenericDecoder::PrefersLateDecoding() const {
192 return _decoder->PrefersLateDecoding(); 201 return _decoder->PrefersLateDecoding();
193 } 202 }
194 203
195 } // namespace webrtc 204 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/generic_decoder.h ('k') | webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698