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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc

Issue 1603643006: Reallocate encoded buffer size if needed. Initially set to the input image size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 11 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 | « no previous file | webrtc/video/video_send_stream_tests.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) { 653 int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) {
654 encoded_image_._length = 0; 654 encoded_image_._length = 0;
655 encoded_image_._frameType = kVideoFrameDelta; 655 encoded_image_._frameType = kVideoFrameDelta;
656 RTPFragmentationHeader frag_info; 656 RTPFragmentationHeader frag_info;
657 // Note: no data partitioning in VP9, so 1 partition only. We keep this 657 // Note: no data partitioning in VP9, so 1 partition only. We keep this
658 // fragmentation data for now, until VP9 packetizer is implemented. 658 // fragmentation data for now, until VP9 packetizer is implemented.
659 frag_info.VerifyAndAllocateFragmentationHeader(1); 659 frag_info.VerifyAndAllocateFragmentationHeader(1);
660 int part_idx = 0; 660 int part_idx = 0;
661 CodecSpecificInfo codec_specific; 661 CodecSpecificInfo codec_specific;
662 662
663 if (pkt->data.frame.sz > encoded_image_._size) {
664 delete[] encoded_image_._buffer;
665 encoded_image_._size = pkt->data.frame.sz;
666 encoded_image_._buffer = new uint8_t[encoded_image_._size];
stefan-webrtc 2016/01/20 12:39:07 Don't you have to copy the existing content of the
åsapersson 2016/01/20 13:32:00 It is only copied once right (line 670). encoded_
stefan-webrtc 2016/01/20 14:11:02 Sure, if you prefer. Although it should as far as
667 }
668
663 assert(pkt->kind == VPX_CODEC_CX_FRAME_PKT); 669 assert(pkt->kind == VPX_CODEC_CX_FRAME_PKT);
664 memcpy(&encoded_image_._buffer[encoded_image_._length], pkt->data.frame.buf, 670 memcpy(&encoded_image_._buffer[encoded_image_._length], pkt->data.frame.buf,
665 pkt->data.frame.sz); 671 pkt->data.frame.sz);
666 frag_info.fragmentationOffset[part_idx] = encoded_image_._length; 672 frag_info.fragmentationOffset[part_idx] = encoded_image_._length;
667 frag_info.fragmentationLength[part_idx] = 673 frag_info.fragmentationLength[part_idx] =
668 static_cast<uint32_t>(pkt->data.frame.sz); 674 static_cast<uint32_t>(pkt->data.frame.sz);
669 frag_info.fragmentationPlType[part_idx] = 0; 675 frag_info.fragmentationPlType[part_idx] = 0;
670 frag_info.fragmentationTimeDiff[part_idx] = 0; 676 frag_info.fragmentationTimeDiff[part_idx] = 0;
671 encoded_image_._length += static_cast<uint32_t>(pkt->data.frame.sz); 677 encoded_image_._length += static_cast<uint32_t>(pkt->data.frame.sz);
672 678
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 frame_buffer_pool_.ClearPool(); 988 frame_buffer_pool_.ClearPool();
983 inited_ = false; 989 inited_ = false;
984 return WEBRTC_VIDEO_CODEC_OK; 990 return WEBRTC_VIDEO_CODEC_OK;
985 } 991 }
986 992
987 const char* VP9DecoderImpl::ImplementationName() const { 993 const char* VP9DecoderImpl::ImplementationName() const {
988 return "libvpx"; 994 return "libvpx";
989 } 995 }
990 996
991 } // namespace webrtc 997 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698