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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc

Issue 1905563002: Add histogram for end-to-end delay. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 7 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 // In practice libvpx keeps a few (~3-4) buffers alive at a time. 911 // In practice libvpx keeps a few (~3-4) buffers alive at a time.
912 if (vpx_codec_decode(decoder_, buffer, 912 if (vpx_codec_decode(decoder_, buffer,
913 static_cast<unsigned int>(input_image._length), 0, 913 static_cast<unsigned int>(input_image._length), 0,
914 VPX_DL_REALTIME)) { 914 VPX_DL_REALTIME)) {
915 return WEBRTC_VIDEO_CODEC_ERROR; 915 return WEBRTC_VIDEO_CODEC_ERROR;
916 } 916 }
917 // |img->fb_priv| contains the image data, a reference counted Vp9FrameBuffer. 917 // |img->fb_priv| contains the image data, a reference counted Vp9FrameBuffer.
918 // It may be released by libvpx during future vpx_codec_decode or 918 // It may be released by libvpx during future vpx_codec_decode or
919 // vpx_codec_destroy calls. 919 // vpx_codec_destroy calls.
920 img = vpx_codec_get_frame(decoder_, &iter); 920 img = vpx_codec_get_frame(decoder_, &iter);
921 int ret = ReturnFrame(img, input_image._timeStamp); 921 int ret = ReturnFrame(img, input_image._timeStamp, input_image.ntp_time_ms_);
922 if (ret != 0) { 922 if (ret != 0) {
923 return ret; 923 return ret;
924 } 924 }
925 return WEBRTC_VIDEO_CODEC_OK; 925 return WEBRTC_VIDEO_CODEC_OK;
926 } 926 }
927 927
928 int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img, uint32_t timestamp) { 928 int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
929 uint32_t timestamp,
930 int64_t ntp_time_ms) {
929 if (img == NULL) { 931 if (img == NULL) {
930 // Decoder OK and NULL image => No show frame. 932 // Decoder OK and NULL image => No show frame.
931 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; 933 return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
932 } 934 }
933 935
934 // This buffer contains all of |img|'s image data, a reference counted 936 // This buffer contains all of |img|'s image data, a reference counted
935 // Vp9FrameBuffer. (libvpx is done with the buffers after a few 937 // Vp9FrameBuffer. (libvpx is done with the buffers after a few
936 // vpx_codec_decode calls or vpx_codec_destroy). 938 // vpx_codec_decode calls or vpx_codec_destroy).
937 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = 939 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer =
938 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); 940 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv);
939 // The buffer can be used directly by the VideoFrame (without copy) by 941 // The buffer can be used directly by the VideoFrame (without copy) by
940 // using a WrappedI420Buffer. 942 // using a WrappedI420Buffer.
941 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer( 943 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer(
942 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( 944 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
943 img->d_w, img->d_h, img->planes[VPX_PLANE_Y], 945 img->d_w, img->d_h, img->planes[VPX_PLANE_Y],
944 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U], 946 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U],
945 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V], 947 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V],
946 img->stride[VPX_PLANE_V], 948 img->stride[VPX_PLANE_V],
947 // WrappedI420Buffer's mechanism for allowing the release of its frame 949 // WrappedI420Buffer's mechanism for allowing the release of its frame
948 // buffer is through a callback function. This is where we should 950 // buffer is through a callback function. This is where we should
949 // release |img_buffer|. 951 // release |img_buffer|.
950 rtc::KeepRefUntilDone(img_buffer))); 952 rtc::KeepRefUntilDone(img_buffer)));
951 953
952 VideoFrame decoded_image; 954 VideoFrame decoded_image;
953 decoded_image.set_video_frame_buffer(img_wrapped_buffer); 955 decoded_image.set_video_frame_buffer(img_wrapped_buffer);
954 decoded_image.set_timestamp(timestamp); 956 decoded_image.set_timestamp(timestamp);
957 decoded_image.set_ntp_time_ms(ntp_time_ms);
955 int ret = decode_complete_callback_->Decoded(decoded_image); 958 int ret = decode_complete_callback_->Decoded(decoded_image);
956 if (ret != 0) 959 if (ret != 0)
957 return ret; 960 return ret;
958 return WEBRTC_VIDEO_CODEC_OK; 961 return WEBRTC_VIDEO_CODEC_OK;
959 } 962 }
960 963
961 int VP9DecoderImpl::RegisterDecodeCompleteCallback( 964 int VP9DecoderImpl::RegisterDecodeCompleteCallback(
962 DecodedImageCallback* callback) { 965 DecodedImageCallback* callback) {
963 decode_complete_callback_ = callback; 966 decode_complete_callback_ = callback;
964 return WEBRTC_VIDEO_CODEC_OK; 967 return WEBRTC_VIDEO_CODEC_OK;
(...skipping 15 matching lines...) Expand all
980 frame_buffer_pool_.ClearPool(); 983 frame_buffer_pool_.ClearPool();
981 inited_ = false; 984 inited_ = false;
982 return WEBRTC_VIDEO_CODEC_OK; 985 return WEBRTC_VIDEO_CODEC_OK;
983 } 986 }
984 987
985 const char* VP9DecoderImpl::ImplementationName() const { 988 const char* VP9DecoderImpl::ImplementationName() const {
986 return "libvpx"; 989 return "libvpx";
987 } 990 }
988 991
989 } // namespace webrtc 992 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698