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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_vp9.cc

Issue 1211353002: Integration of VP9 packetization. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: set ss data if not set Created 5 years, 4 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 636 }
637 637
638 bool RtpPacketizerVp9::WriteHeader(const PacketInfo& packet_info, 638 bool RtpPacketizerVp9::WriteHeader(const PacketInfo& packet_info,
639 uint8_t* buffer, 639 uint8_t* buffer,
640 size_t* header_length) const { 640 size_t* header_length) const {
641 // Required payload descriptor byte. 641 // Required payload descriptor byte.
642 bool i_bit = PictureIdPresent(hdr_); 642 bool i_bit = PictureIdPresent(hdr_);
643 bool p_bit = hdr_.inter_pic_predicted; 643 bool p_bit = hdr_.inter_pic_predicted;
644 bool l_bit = LayerInfoPresent(hdr_); 644 bool l_bit = LayerInfoPresent(hdr_);
645 bool f_bit = hdr_.flexible_mode; 645 bool f_bit = hdr_.flexible_mode;
646 bool b_bit = hdr_.beginning_of_frame && packet_info.layer_begin; 646 bool b_bit = packet_info.layer_begin;
647 bool e_bit = hdr_.end_of_frame && packet_info.layer_end; 647 bool e_bit = packet_info.layer_end;
648 bool v_bit = hdr_.ss_data_available && b_bit; 648 bool v_bit = hdr_.ss_data_available && b_bit;
649 649
650 rtc::BitBufferWriter writer(buffer, max_payload_length_); 650 rtc::BitBufferWriter writer(buffer, max_payload_length_);
651 RETURN_FALSE_ON_ERROR(writer.WriteBits(i_bit ? 1 : 0, 1)); 651 RETURN_FALSE_ON_ERROR(writer.WriteBits(i_bit ? 1 : 0, 1));
652 RETURN_FALSE_ON_ERROR(writer.WriteBits(p_bit ? 1 : 0, 1)); 652 RETURN_FALSE_ON_ERROR(writer.WriteBits(p_bit ? 1 : 0, 1));
653 RETURN_FALSE_ON_ERROR(writer.WriteBits(l_bit ? 1 : 0, 1)); 653 RETURN_FALSE_ON_ERROR(writer.WriteBits(l_bit ? 1 : 0, 1));
654 RETURN_FALSE_ON_ERROR(writer.WriteBits(f_bit ? 1 : 0, 1)); 654 RETURN_FALSE_ON_ERROR(writer.WriteBits(f_bit ? 1 : 0, 1));
655 RETURN_FALSE_ON_ERROR(writer.WriteBits(b_bit ? 1 : 0, 1)); 655 RETURN_FALSE_ON_ERROR(writer.WriteBits(b_bit ? 1 : 0, 1));
656 RETURN_FALSE_ON_ERROR(writer.WriteBits(e_bit ? 1 : 0, 1)); 656 RETURN_FALSE_ON_ERROR(writer.WriteBits(e_bit ? 1 : 0, 1));
657 RETURN_FALSE_ON_ERROR(writer.WriteBits(v_bit ? 1 : 0, 1)); 657 RETURN_FALSE_ON_ERROR(writer.WriteBits(v_bit ? 1 : 0, 1));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 713
714 parsed_payload->frame_type = p_bit ? kVideoFrameDelta : kVideoFrameKey; 714 parsed_payload->frame_type = p_bit ? kVideoFrameDelta : kVideoFrameKey;
715 715
716 RTPVideoHeaderVP9* vp9 = &parsed_payload->type.Video.codecHeader.VP9; 716 RTPVideoHeaderVP9* vp9 = &parsed_payload->type.Video.codecHeader.VP9;
717 vp9->InitRTPVideoHeaderVP9(); 717 vp9->InitRTPVideoHeaderVP9();
718 vp9->inter_pic_predicted = p_bit ? true : false; 718 vp9->inter_pic_predicted = p_bit ? true : false;
719 vp9->flexible_mode = f_bit ? true : false; 719 vp9->flexible_mode = f_bit ? true : false;
720 vp9->beginning_of_frame = b_bit ? true : false; 720 vp9->beginning_of_frame = b_bit ? true : false;
721 vp9->end_of_frame = e_bit ? true : false; 721 vp9->end_of_frame = e_bit ? true : false;
722 vp9->ss_data_available = v_bit ? true : false; 722 vp9->ss_data_available = v_bit ? true : false;
723 vp9->temporal_idx = 0;
724 vp9->spatial_idx = 0; 723 vp9->spatial_idx = 0;
725 724
726 // Parse fields that are present. 725 // Parse fields that are present.
727 if (i_bit && !ParsePictureId(&parser, vp9)) { 726 if (i_bit && !ParsePictureId(&parser, vp9)) {
728 LOG(LS_ERROR) << "Failed parsing VP9 picture id."; 727 LOG(LS_ERROR) << "Failed parsing VP9 picture id.";
729 return false; 728 return false;
730 } 729 }
731 if (l_bit && !ParseLayerInfo(&parser, vp9)) { 730 if (l_bit && !ParseLayerInfo(&parser, vp9)) {
732 LOG(LS_ERROR) << "Failed parsing VP9 layer info."; 731 LOG(LS_ERROR) << "Failed parsing VP9 layer info.";
733 return false; 732 return false;
(...skipping 21 matching lines...) Expand all
755 if (parsed_payload->payload_length == 0) { 754 if (parsed_payload->payload_length == 0) {
756 LOG(LS_ERROR) << "Failed parsing VP9 payload data."; 755 LOG(LS_ERROR) << "Failed parsing VP9 payload data.";
757 return false; 756 return false;
758 } 757 }
759 parsed_payload->payload = 758 parsed_payload->payload =
760 payload + payload_length - parsed_payload->payload_length; 759 payload + payload_length - parsed_payload->payload_length;
761 760
762 return true; 761 return true;
763 } 762 }
764 } // namespace webrtc 763 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/interface/module_common_types.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_vp9_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698