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

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

Issue 2816463002: Revert of Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Created 3 years, 8 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (!decode_time_ms) { 80 if (!decode_time_ms) {
81 decode_time_ms = 81 decode_time_ms =
82 rtc::Optional<int32_t>(now_ms - frameInfo->decodeStartTimeMs); 82 rtc::Optional<int32_t>(now_ms - frameInfo->decodeStartTimeMs);
83 } 83 }
84 _timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms, 84 _timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms,
85 frameInfo->renderTimeMs); 85 frameInfo->renderTimeMs);
86 86
87 decodedImage.set_timestamp_us( 87 decodedImage.set_timestamp_us(
88 frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec); 88 frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec);
89 decodedImage.set_rotation(frameInfo->rotation); 89 decodedImage.set_rotation(frameInfo->rotation);
90 _receiveCallback->FrameToRender(decodedImage, qp, frameInfo->content_type); 90 _receiveCallback->FrameToRender(decodedImage, qp);
91 } 91 }
92 92
93 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame( 93 int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
94 const uint64_t pictureId) { 94 const uint64_t pictureId) {
95 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId); 95 return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId);
96 } 96 }
97 97
98 int32_t VCMDecodedFrameCallback::ReceivedDecodedFrame( 98 int32_t VCMDecodedFrameCallback::ReceivedDecodedFrame(
99 const uint64_t pictureId) { 99 const uint64_t pictureId) {
100 _lastReceivedPictureID = pictureId; 100 _lastReceivedPictureID = pictureId;
(...skipping 23 matching lines...) Expand all
124 return VCM_OK; 124 return VCM_OK;
125 } 125 }
126 126
127 VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal) 127 VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal)
128 : _callback(NULL), 128 : _callback(NULL),
129 _frameInfos(), 129 _frameInfos(),
130 _nextFrameInfoIdx(0), 130 _nextFrameInfoIdx(0),
131 _decoder(decoder), 131 _decoder(decoder),
132 _codecType(kVideoCodecUnknown), 132 _codecType(kVideoCodecUnknown),
133 _isExternal(isExternal), 133 _isExternal(isExternal),
134 _keyFrameDecoded(false), 134 _keyFrameDecoded(false) {}
135 _last_keyframe_content_type(VideoContentType::UNSPECIFIED) {}
136 135
137 VCMGenericDecoder::~VCMGenericDecoder() {} 136 VCMGenericDecoder::~VCMGenericDecoder() {}
138 137
139 int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings, 138 int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings,
140 int32_t numberOfCores) { 139 int32_t numberOfCores) {
141 TRACE_EVENT0("webrtc", "VCMGenericDecoder::InitDecode"); 140 TRACE_EVENT0("webrtc", "VCMGenericDecoder::InitDecode");
142 _codecType = settings->codecType; 141 _codecType = settings->codecType;
143 142
144 return _decoder->InitDecode(settings, numberOfCores); 143 return _decoder->InitDecode(settings, numberOfCores);
145 } 144 }
146 145
147 int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) { 146 int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) {
148 TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp", 147 TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
149 frame.EncodedImage()._timeStamp); 148 frame.EncodedImage()._timeStamp);
150 _frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs; 149 _frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs;
151 _frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs(); 150 _frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
152 _frameInfos[_nextFrameInfoIdx].rotation = frame.rotation(); 151 _frameInfos[_nextFrameInfoIdx].rotation = frame.rotation();
153 // Set correctly only for key frames. Thus, use latest key frame
154 // content type. If the corresponding key frame was lost, decode will fail
155 // and content type will be ignored.
156 if (frame.FrameType() == kVideoFrameKey) {
157 _frameInfos[_nextFrameInfoIdx].content_type = frame.contentType();
158 _last_keyframe_content_type = frame.contentType();
159 } else {
160 _frameInfos[_nextFrameInfoIdx].content_type = _last_keyframe_content_type;
161 }
162 _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]); 152 _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
163 153
164 _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; 154 _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
165 const RTPFragmentationHeader dummy_header; 155 const RTPFragmentationHeader dummy_header;
166 int32_t ret = _decoder->Decode(frame.EncodedImage(), frame.MissingFrame(), 156 int32_t ret = _decoder->Decode(frame.EncodedImage(), frame.MissingFrame(),
167 &dummy_header, 157 &dummy_header,
168 frame.CodecSpecific(), frame.RenderTimeMs()); 158 frame.CodecSpecific(), frame.RenderTimeMs());
169 159
170 _callback->OnDecoderImplementationName(_decoder->ImplementationName()); 160 _callback->OnDecoderImplementationName(_decoder->ImplementationName());
171 if (ret < WEBRTC_VIDEO_CODEC_OK) { 161 if (ret < WEBRTC_VIDEO_CODEC_OK) {
(...skipping 21 matching lines...) Expand all
193 183
194 bool VCMGenericDecoder::External() const { 184 bool VCMGenericDecoder::External() const {
195 return _isExternal; 185 return _isExternal;
196 } 186 }
197 187
198 bool VCMGenericDecoder::PrefersLateDecoding() const { 188 bool VCMGenericDecoder::PrefersLateDecoding() const {
199 return _decoder->PrefersLateDecoding(); 189 return _decoder->PrefersLateDecoding();
200 } 190 }
201 191
202 } // namespace webrtc 192 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/generic_decoder.h ('k') | webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698