Skip to content

Commit

Permalink
Bug 1033335: Don't send IDRs to change bitrates or periodic ones to f…
Browse files Browse the repository at this point in the history
…ix encoder errors r=pkerr
  • Loading branch information
jesup committed Oct 7, 2014
1 parent 2ac7cc8 commit 0d9b8ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,9 @@ WebrtcOMXH264VideoEncoder::WebrtcOMXH264VideoEncoder()
, mHeight(0)
, mFrameRate(0)
, mBitRateKbps(0)
#ifdef OMX_IDR_NEEDED_FOR_BITRATE
, mBitRateAtLastIDR(0)
#endif
, mOMXConfigured(false)
, mOMXReconfigure(false)
{
Expand Down Expand Up @@ -903,13 +905,16 @@ WebrtcOMXH264VideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage,
return WEBRTC_VIDEO_CODEC_ERROR;
}
mOMXConfigured = true;
#ifdef OMX_IDR_NEEDED_FOR_BITRATE
mLastIDRTime = TimeStamp::Now();
mBitRateAtLastIDR = mBitRateKbps;
#endif
}

if (aFrameTypes && aFrameTypes->size() &&
((*aFrameTypes)[0] == webrtc::kKeyFrame)) {
mOMX->RequestIDRFrame();
#ifdef OMX_IDR_NEEDED_FOR_BITRATE
mLastIDRTime = TimeStamp::Now();
mBitRateAtLastIDR = mBitRateKbps;
} else if (mBitRateKbps != mBitRateAtLastIDR) {
Expand Down Expand Up @@ -942,6 +947,7 @@ WebrtcOMXH264VideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage,
mLastIDRTime = now;
mBitRateAtLastIDR = mBitRateKbps;
}
#endif
}

// Wrap I420VideoFrame input with PlanarYCbCrImage for OMXVideoEncoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class OMXOutputDrain;

// XXX see if we can reduce this
#define WEBRTC_OMX_H264_MIN_DECODE_BUFFERS 10
#define OMX_IDR_NEEDED_FOR_BITRATE 0

class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
{
Expand Down Expand Up @@ -64,8 +65,10 @@ class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
uint32_t mHeight;
uint32_t mFrameRate;
uint32_t mBitRateKbps;
#ifdef OMX_IDR_NEEDED_FOR_BITRATE
uint32_t mBitRateAtLastIDR;
TimeStamp mLastIDRTime;
#endif
bool mOMXConfigured;
bool mOMXReconfigure;
webrtc::EncodedImage mEncodedImage;
Expand Down

0 comments on commit 0d9b8ad

Please sign in to comment.