Bug 1355048: P4. Remove unnecessary test, and make better use of monitor. r?jesup
MozReview-Commit-ID: F5qu7e6opZX
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -2212,43 +2212,42 @@ public:
uint32_t y_stride,
const uint8_t* buffer_u,
uint32_t u_stride,
const uint8_t* buffer_v,
uint32_t v_stride,
uint32_t time_stamp,
int64_t render_time)
{
- ReentrantMonitorAutoEnter enter(monitor_);
-
- if (buffer_y) {
- // Create a video frame using |buffer|.
- RefPtr<PlanarYCbCrImage> yuvImage = image_container_->CreatePlanarYCbCrImage();
+ MOZ_ASSERT(buffer_y);
+ // Create a video frame using |buffer|.
+ RefPtr<PlanarYCbCrImage> yuvImage =
+ image_container_->CreatePlanarYCbCrImage();
- PlanarYCbCrData yuvData;
- yuvData.mYChannel = const_cast<uint8_t*>(buffer_y);
- yuvData.mYSize = IntSize(y_stride, height_);
- yuvData.mYStride = y_stride;
- MOZ_ASSERT(u_stride == v_stride);
- yuvData.mCbCrStride = u_stride;
- yuvData.mCbChannel = const_cast<uint8_t*>(buffer_u);
- yuvData.mCrChannel = const_cast<uint8_t*>(buffer_v);
- yuvData.mCbCrSize = IntSize(yuvData.mCbCrStride, (height_ + 1) >> 1);
- yuvData.mPicX = 0;
- yuvData.mPicY = 0;
- yuvData.mPicSize = IntSize(width_, height_);
- yuvData.mStereoMode = StereoMode::MONO;
+ PlanarYCbCrData yuvData;
+ yuvData.mYChannel = const_cast<uint8_t*>(buffer_y);
+ yuvData.mYSize = IntSize(y_stride, height_);
+ yuvData.mYStride = y_stride;
+ MOZ_ASSERT(u_stride == v_stride);
+ yuvData.mCbCrStride = u_stride;
+ yuvData.mCbChannel = const_cast<uint8_t*>(buffer_u);
+ yuvData.mCrChannel = const_cast<uint8_t*>(buffer_v);
+ yuvData.mCbCrSize = IntSize(yuvData.mCbCrStride, (height_ + 1) >> 1);
+ yuvData.mPicX = 0;
+ yuvData.mPicY = 0;
+ yuvData.mPicSize = IntSize(width_, height_);
+ yuvData.mStereoMode = StereoMode::MONO;
- if (!yuvImage->CopyData(yuvData)) {
- MOZ_ASSERT(false);
- return;
- }
+ if (!yuvImage->CopyData(yuvData)) {
+ MOZ_ASSERT(false);
+ return;
+ }
- image_ = yuvImage;
- }
+ ReentrantMonitorAutoEnter enter(monitor_);
+ image_ = yuvImage;
}
private:
int width_;
int height_;
RefPtr<layers::ImageContainer> image_container_;
RefPtr<layers::Image> image_;
mozilla::ReentrantMonitor monitor_; // Monitor for processing WebRTC frames.