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

Side by Side Diff: modules/video_coding/rtp_frame_reference_finder.cc

Issue 2951033003: [EXPERIMENTAL] Generic stereo codec with index header sending single frames
Patch Set: Rebase and add external codec support. Created 3 years, 2 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
« no previous file with comments | « modules/video_coding/packet.cc ('k') | modules/video_coding/video_codec_initializer.cc » ('j') | 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return ManageFrameVp9(frame); 93 return ManageFrameVp9(frame);
94 // Since the EndToEndTests use kVicdeoCodecUnknow we treat it the same as 94 // Since the EndToEndTests use kVicdeoCodecUnknow we treat it the same as
95 // kVideoCodecGeneric. 95 // kVideoCodecGeneric.
96 // TODO(philipel): Take a look at the EndToEndTests and see if maybe they 96 // TODO(philipel): Take a look at the EndToEndTests and see if maybe they
97 // should be changed to use kVideoCodecGeneric instead. 97 // should be changed to use kVideoCodecGeneric instead.
98 case kVideoCodecUnknown: 98 case kVideoCodecUnknown:
99 case kVideoCodecH264: 99 case kVideoCodecH264:
100 case kVideoCodecI420: 100 case kVideoCodecI420:
101 case kVideoCodecGeneric: 101 case kVideoCodecGeneric:
102 return ManageFrameGeneric(frame, kNoPictureId); 102 return ManageFrameGeneric(frame, kNoPictureId);
103 case kVideoCodecStereo:
104 return ManageFrameVp9(frame);
103 } 105 }
104 106
105 // If not all code paths return a value it makes the win compiler sad. 107 // If not all code paths return a value it makes the win compiler sad.
106 RTC_NOTREACHED(); 108 RTC_NOTREACHED();
107 return kDrop; 109 return kDrop;
108 } 110 }
109 111
110 void RtpFrameReferenceFinder::PaddingReceived(uint16_t seq_num) { 112 void RtpFrameReferenceFinder::PaddingReceived(uint16_t seq_num) {
111 rtc::CritScope lock(&crit_); 113 rtc::CritScope lock(&crit_);
112 auto clean_padding_to = 114 auto clean_padding_to =
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader(); 400 rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
399 if (!rtp_codec_header) { 401 if (!rtp_codec_header) {
400 LOG(LS_WARNING) << "Failed to get codec header from frame, dropping frame."; 402 LOG(LS_WARNING) << "Failed to get codec header from frame, dropping frame.";
401 return kDrop; 403 return kDrop;
402 } 404 }
403 405
404 const RTPVideoHeaderVP9& codec_header = rtp_codec_header->VP9; 406 const RTPVideoHeaderVP9& codec_header = rtp_codec_header->VP9;
405 407
406 if (codec_header.picture_id == kNoPictureId || 408 if (codec_header.picture_id == kNoPictureId ||
407 codec_header.temporal_idx == kNoTemporalIdx) { 409 codec_header.temporal_idx == kNoTemporalIdx) {
408 return ManageFrameGeneric(std::move(frame), codec_header.picture_id); 410 return ManageFrameGeneric(std::move(frame), kNoPictureId);
409 } 411 }
410 412
411 frame->spatial_layer = codec_header.spatial_idx; 413 frame->spatial_layer = codec_header.spatial_idx;
412 frame->inter_layer_predicted = codec_header.inter_layer_predicted; 414 frame->inter_layer_predicted = codec_header.inter_layer_predicted;
413 frame->picture_id = codec_header.picture_id % kPicIdLength; 415 frame->picture_id = codec_header.picture_id % kPicIdLength;
414
415 if (last_unwrap_ == -1) 416 if (last_unwrap_ == -1)
416 last_unwrap_ = codec_header.picture_id; 417 last_unwrap_ = codec_header.picture_id;
417 418
418 if (last_picture_id_ == -1) 419 if (last_picture_id_ == -1)
419 last_picture_id_ = frame->picture_id; 420 last_picture_id_ = frame->picture_id;
420 421
421 if (codec_header.flexible_mode) { 422 if (codec_header.flexible_mode) {
422 frame->num_references = codec_header.num_ref_pics; 423 frame->num_references = codec_header.num_ref_pics;
423 for (size_t i = 0; i < frame->num_references; ++i) { 424 for (size_t i = 0; i < frame->num_references; ++i) {
424 frame->references[i] = 425 frame->references[i] =
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 591 }
591 592
592 void RtpFrameReferenceFinder::UnwrapPictureIds(RtpFrameObject* frame) { 593 void RtpFrameReferenceFinder::UnwrapPictureIds(RtpFrameObject* frame) {
593 for (size_t i = 0; i < frame->num_references; ++i) 594 for (size_t i = 0; i < frame->num_references; ++i)
594 frame->references[i] = unwrapper_.Unwrap(frame->references[i]); 595 frame->references[i] = unwrapper_.Unwrap(frame->references[i]);
595 frame->picture_id = unwrapper_.Unwrap(frame->picture_id); 596 frame->picture_id = unwrapper_.Unwrap(frame->picture_id);
596 } 597 }
597 598
598 } // namespace video_coding 599 } // namespace video_coding
599 } // namespace webrtc 600 } // namespace webrtc
OLDNEW
« no previous file with comments | « modules/video_coding/packet.cc ('k') | modules/video_coding/video_codec_initializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698