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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 1626373002: Reallocate encoded buffer size if needed for VP8. Initially set to the input image size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 | « webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.cc ('k') | no next file » | 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) 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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 // token_partitions_ is number of bits used. 964 // token_partitions_ is number of bits used.
965 frag_info.VerifyAndAllocateFragmentationHeader((1 << token_partitions_) + 965 frag_info.VerifyAndAllocateFragmentationHeader((1 << token_partitions_) +
966 1); 966 1);
967 CodecSpecificInfo codec_specific; 967 CodecSpecificInfo codec_specific;
968 const vpx_codec_cx_pkt_t* pkt = NULL; 968 const vpx_codec_cx_pkt_t* pkt = NULL;
969 while ((pkt = vpx_codec_get_cx_data(&encoders_[encoder_idx], &iter)) != 969 while ((pkt = vpx_codec_get_cx_data(&encoders_[encoder_idx], &iter)) !=
970 NULL) { 970 NULL) {
971 switch (pkt->kind) { 971 switch (pkt->kind) {
972 case VPX_CODEC_CX_FRAME_PKT: { 972 case VPX_CODEC_CX_FRAME_PKT: {
973 uint32_t length = encoded_images_[encoder_idx]._length; 973 uint32_t length = encoded_images_[encoder_idx]._length;
974 if (pkt->data.frame.sz + length >
975 encoded_images_[encoder_idx]._size) {
976 uint8_t* buffer = new uint8_t[pkt->data.frame.sz + length];
977 memcpy(buffer, encoded_images_[encoder_idx]._buffer, length);
978 delete[] encoded_images_[encoder_idx]._buffer;
979 encoded_images_[encoder_idx]._buffer = buffer;
980 encoded_images_[encoder_idx]._size = pkt->data.frame.sz + length;
981 }
974 memcpy(&encoded_images_[encoder_idx]._buffer[length], 982 memcpy(&encoded_images_[encoder_idx]._buffer[length],
975 pkt->data.frame.buf, pkt->data.frame.sz); 983 pkt->data.frame.buf, pkt->data.frame.sz);
976 frag_info.fragmentationOffset[part_idx] = length; 984 frag_info.fragmentationOffset[part_idx] = length;
977 frag_info.fragmentationLength[part_idx] = pkt->data.frame.sz; 985 frag_info.fragmentationLength[part_idx] = pkt->data.frame.sz;
978 frag_info.fragmentationPlType[part_idx] = 0; // not known here 986 frag_info.fragmentationPlType[part_idx] = 0; // not known here
979 frag_info.fragmentationTimeDiff[part_idx] = 0; 987 frag_info.fragmentationTimeDiff[part_idx] = 0;
980 encoded_images_[encoder_idx]._length += pkt->data.frame.sz; 988 encoded_images_[encoder_idx]._length += pkt->data.frame.sz;
981 assert(length <= encoded_images_[encoder_idx]._size); 989 assert(length <= encoded_images_[encoder_idx]._size);
982 ++part_idx; 990 ++part_idx;
983 break; 991 break;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 return -1; 1401 return -1;
1394 } 1402 }
1395 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1403 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1396 VPX_CODEC_OK) { 1404 VPX_CODEC_OK) {
1397 return -1; 1405 return -1;
1398 } 1406 }
1399 return 0; 1407 return 0;
1400 } 1408 }
1401 1409
1402 } // namespace webrtc 1410 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698