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

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 + add separate histogram for end-to-end delay Created 4 years, 3 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
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp9/vp9_impl.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // In practice libvpx keeps a few (~3-4) buffers alive at a time. 924 // In practice libvpx keeps a few (~3-4) buffers alive at a time.
925 if (vpx_codec_decode(decoder_, buffer, 925 if (vpx_codec_decode(decoder_, buffer,
926 static_cast<unsigned int>(input_image._length), 0, 926 static_cast<unsigned int>(input_image._length), 0,
927 VPX_DL_REALTIME)) { 927 VPX_DL_REALTIME)) {
928 return WEBRTC_VIDEO_CODEC_ERROR; 928 return WEBRTC_VIDEO_CODEC_ERROR;
929 } 929 }
930 // |img->fb_priv| contains the image data, a reference counted Vp9FrameBuffer. 930 // |img->fb_priv| contains the image data, a reference counted Vp9FrameBuffer.
931 // It may be released by libvpx during future vpx_codec_decode or 931 // It may be released by libvpx during future vpx_codec_decode or
932 // vpx_codec_destroy calls. 932 // vpx_codec_destroy calls.
933 img = vpx_codec_get_frame(decoder_, &iter); 933 img = vpx_codec_get_frame(decoder_, &iter);
934 int ret = ReturnFrame(img, input_image._timeStamp); 934 int ret = ReturnFrame(img, input_image._timeStamp, input_image.ntp_time_ms_);
935 if (ret != 0) { 935 if (ret != 0) {
936 return ret; 936 return ret;
937 } 937 }
938 return WEBRTC_VIDEO_CODEC_OK; 938 return WEBRTC_VIDEO_CODEC_OK;
939 } 939 }
940 940
941 int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img, uint32_t timestamp) { 941 int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
942 uint32_t timestamp,
943 int64_t ntp_time_ms) {
942 if (img == NULL) { 944 if (img == NULL) {
943 // Decoder OK and NULL image => No show frame. 945 // Decoder OK and NULL image => No show frame.
944 return WEBRTC_VIDEO_CODEC_NO_OUTPUT; 946 return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
945 } 947 }
946 948
947 // This buffer contains all of |img|'s image data, a reference counted 949 // This buffer contains all of |img|'s image data, a reference counted
948 // Vp9FrameBuffer. (libvpx is done with the buffers after a few 950 // Vp9FrameBuffer. (libvpx is done with the buffers after a few
949 // vpx_codec_decode calls or vpx_codec_destroy). 951 // vpx_codec_decode calls or vpx_codec_destroy).
950 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer = 952 Vp9FrameBufferPool::Vp9FrameBuffer* img_buffer =
951 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv); 953 static_cast<Vp9FrameBufferPool::Vp9FrameBuffer*>(img->fb_priv);
952 // The buffer can be used directly by the VideoFrame (without copy) by 954 // The buffer can be used directly by the VideoFrame (without copy) by
953 // using a WrappedI420Buffer. 955 // using a WrappedI420Buffer.
954 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer( 956 rtc::scoped_refptr<WrappedI420Buffer> img_wrapped_buffer(
955 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( 957 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
956 img->d_w, img->d_h, img->planes[VPX_PLANE_Y], 958 img->d_w, img->d_h, img->planes[VPX_PLANE_Y],
957 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U], 959 img->stride[VPX_PLANE_Y], img->planes[VPX_PLANE_U],
958 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V], 960 img->stride[VPX_PLANE_U], img->planes[VPX_PLANE_V],
959 img->stride[VPX_PLANE_V], 961 img->stride[VPX_PLANE_V],
960 // WrappedI420Buffer's mechanism for allowing the release of its frame 962 // WrappedI420Buffer's mechanism for allowing the release of its frame
961 // buffer is through a callback function. This is where we should 963 // buffer is through a callback function. This is where we should
962 // release |img_buffer|. 964 // release |img_buffer|.
963 rtc::KeepRefUntilDone(img_buffer))); 965 rtc::KeepRefUntilDone(img_buffer)));
964 966
965 VideoFrame decoded_image(img_wrapped_buffer, timestamp, 967 VideoFrame decoded_image(img_wrapped_buffer, timestamp,
966 0 /* render_time_ms */, webrtc::kVideoRotation_0); 968 0 /* render_time_ms */, webrtc::kVideoRotation_0);
969 decoded_image.set_ntp_time_ms(ntp_time_ms);
967 970
968 int ret = decode_complete_callback_->Decoded(decoded_image); 971 int ret = decode_complete_callback_->Decoded(decoded_image);
969 if (ret != 0) 972 if (ret != 0)
970 return ret; 973 return ret;
971 return WEBRTC_VIDEO_CODEC_OK; 974 return WEBRTC_VIDEO_CODEC_OK;
972 } 975 }
973 976
974 int VP9DecoderImpl::RegisterDecodeCompleteCallback( 977 int VP9DecoderImpl::RegisterDecodeCompleteCallback(
975 DecodedImageCallback* callback) { 978 DecodedImageCallback* callback) {
976 decode_complete_callback_ = callback; 979 decode_complete_callback_ = callback;
(...skipping 16 matching lines...) Expand all
993 frame_buffer_pool_.ClearPool(); 996 frame_buffer_pool_.ClearPool();
994 inited_ = false; 997 inited_ = false;
995 return WEBRTC_VIDEO_CODEC_OK; 998 return WEBRTC_VIDEO_CODEC_OK;
996 } 999 }
997 1000
998 const char* VP9DecoderImpl::ImplementationName() const { 1001 const char* VP9DecoderImpl::ImplementationName() const {
999 return "libvpx"; 1002 return "libvpx";
1000 } 1003 }
1001 1004
1002 } // namespace webrtc 1005 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp9/vp9_impl.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698