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

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc

Issue 2927943003: Return WrappedI444Buffer in VP9Impl (Closed)
Patch Set: Fix Windows compile error Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 int qp_int; 363 int qp_int;
364 if (h264_bitstream_parser_.GetLastSliceQp(&qp_int)) { 364 if (h264_bitstream_parser_.GetLastSliceQp(&qp_int)) {
365 qp.emplace(qp_int); 365 qp.emplace(qp_int);
366 } 366 }
367 367
368 // The decoded image may be larger than what is supposed to be visible, see 368 // The decoded image may be larger than what is supposed to be visible, see
369 // |AVGetBuffer2|'s use of |avcodec_align_dimensions|. This crops the image 369 // |AVGetBuffer2|'s use of |avcodec_align_dimensions|. This crops the image
370 // without copying the underlying buffer. 370 // without copying the underlying buffer.
371 if (av_frame_->width != i420_buffer->width() || 371 if (av_frame_->width != i420_buffer->width() ||
372 av_frame_->height != i420_buffer->height()) { 372 av_frame_->height != i420_buffer->height()) {
373 rtc::scoped_refptr<VideoFrameBuffer> cropped_buf( 373 rtc::scoped_refptr<VideoFrameBuffer> cropped_buf(WrapI420Buffer(
374 new rtc::RefCountedObject<WrappedI420Buffer>( 374 av_frame_->width, av_frame_->height,
375 av_frame_->width, av_frame_->height, 375 i420_buffer->DataY(), i420_buffer->StrideY(),
376 i420_buffer->DataY(), i420_buffer->StrideY(), 376 i420_buffer->DataU(), i420_buffer->StrideU(),
377 i420_buffer->DataU(), i420_buffer->StrideU(), 377 i420_buffer->DataV(), i420_buffer->StrideV(),
378 i420_buffer->DataV(), i420_buffer->StrideV(), 378 rtc::KeepRefUntilDone(i420_buffer)));
379 rtc::KeepRefUntilDone(i420_buffer)));
380 VideoFrame cropped_frame( 379 VideoFrame cropped_frame(
381 cropped_buf, video_frame->timestamp(), video_frame->render_time_ms(), 380 cropped_buf, video_frame->timestamp(), video_frame->render_time_ms(),
382 video_frame->rotation()); 381 video_frame->rotation());
383 // TODO(nisse): Timestamp and rotation are all zero here. Change decoder 382 // TODO(nisse): Timestamp and rotation are all zero here. Change decoder
384 // interface to pass a VideoFrameBuffer instead of a VideoFrame? 383 // interface to pass a VideoFrameBuffer instead of a VideoFrame?
385 decoded_image_callback_->Decoded(cropped_frame, rtc::Optional<int32_t>(), 384 decoded_image_callback_->Decoded(cropped_frame, rtc::Optional<int32_t>(),
386 qp); 385 qp);
387 } else { 386 } else {
388 // Return decoded frame. 387 // Return decoded frame.
389 decoded_image_callback_->Decoded(*video_frame, rtc::Optional<int32_t>(), 388 decoded_image_callback_->Decoded(*video_frame, rtc::Optional<int32_t>(),
(...skipping 26 matching lines...) Expand all
416 void H264DecoderImpl::ReportError() { 415 void H264DecoderImpl::ReportError() {
417 if (has_reported_error_) 416 if (has_reported_error_)
418 return; 417 return;
419 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.H264DecoderImpl.Event", 418 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.H264DecoderImpl.Event",
420 kH264DecoderEventError, 419 kH264DecoderEventError,
421 kH264DecoderEventMax); 420 kH264DecoderEventMax);
422 has_reported_error_ = true; 421 has_reported_error_ = true;
423 } 422 }
424 423
425 } // namespace webrtc 424 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698