Add checks for buffer size in MediaCodecVideoEncoder.

This should help users of the library to more easily debug issues.

Bug: None
Change-Id: I85d8101d3b26ccbc34c8beded069461252e61293
Reviewed-on: https://webrtc-review.googlesource.com/4663
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20073}
This commit is contained in:
Sami Kalliomäki
2017-10-02 09:41:55 +02:00
committed by Commit Bot
parent a58f231018
commit e3044fe12e
3 changed files with 37 additions and 12 deletions

View File

@ -1478,6 +1478,13 @@ JNI_FUNCTION_DECLARATION(void,
uint8_t* buffer_v =
static_cast<uint8_t*>(jni->GetDirectBufferAddress(j_buffer_v));
RTC_DCHECK(buffer_y) << "GetDirectBufferAddress returned null. Ensure that "
"getDataY returns a direct ByteBuffer.";
RTC_DCHECK(buffer_u) << "GetDirectBufferAddress returned null. Ensure that "
"getDataU returns a direct ByteBuffer.";
RTC_DCHECK(buffer_v) << "GetDirectBufferAddress returned null. Ensure that "
"getDataV returns a direct ByteBuffer.";
reinterpret_cast<MediaCodecVideoEncoder*>(native_encoder)
->FillInputBuffer(jni, input_buffer, buffer_y, stride_y, buffer_u,
stride_u, buffer_v, stride_v);