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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 return num_buffers_in_use; 92 return num_buffers_in_use;
93 } 93 }
94 94
95 void Vp9FrameBufferPool::ClearPool() { 95 void Vp9FrameBufferPool::ClearPool() {
96 rtc::CritScope cs(&buffers_lock_); 96 rtc::CritScope cs(&buffers_lock_);
97 allocated_buffers_.clear(); 97 allocated_buffers_.clear();
98 } 98 }
99 99
100 // static 100 // static
101 int32 Vp9FrameBufferPool::VpxGetFrameBuffer(void* user_priv, 101 int32_t Vp9FrameBufferPool::VpxGetFrameBuffer(void* user_priv,
102 size_t min_size, 102 size_t min_size,
103 vpx_codec_frame_buffer* fb) { 103 vpx_codec_frame_buffer* fb) {
104 RTC_DCHECK(user_priv); 104 RTC_DCHECK(user_priv);
105 RTC_DCHECK(fb); 105 RTC_DCHECK(fb);
106 Vp9FrameBufferPool* pool = static_cast<Vp9FrameBufferPool*>(user_priv); 106 Vp9FrameBufferPool* pool = static_cast<Vp9FrameBufferPool*>(user_priv);
107 107
108 rtc::scoped_refptr<Vp9FrameBuffer> buffer = pool->GetFrameBuffer(min_size); 108 rtc::scoped_refptr<Vp9FrameBuffer> buffer = pool->GetFrameBuffer(min_size);
109 fb->data = buffer->GetData(); 109 fb->data = buffer->GetData();
110 fb->size = buffer->GetDataSize(); 110 fb->size = buffer->GetDataSize();
111 // Store Vp9FrameBuffer* in |priv| for use in VpxReleaseFrameBuffer. 111 // Store Vp9FrameBuffer* in |priv| for use in VpxReleaseFrameBuffer.
112 // This also makes vpx_codec_get_frame return images with their |fb_priv| set 112 // This also makes vpx_codec_get_frame return images with their |fb_priv| set
113 // to |buffer| which is important for external reference counting. 113 // to |buffer| which is important for external reference counting.
114 // Release from refptr so that the buffer's |ref_count_| remains 1 when 114 // Release from refptr so that the buffer's |ref_count_| remains 1 when
115 // |buffer| goes out of scope. 115 // |buffer| goes out of scope.
116 fb->priv = static_cast<void*>(buffer.release()); 116 fb->priv = static_cast<void*>(buffer.release());
117 return 0; 117 return 0;
118 } 118 }
119 119
120 // static 120 // static
121 int32 Vp9FrameBufferPool::VpxReleaseFrameBuffer(void* user_priv, 121 int32_t Vp9FrameBufferPool::VpxReleaseFrameBuffer(void* user_priv,
122 vpx_codec_frame_buffer* fb) { 122 vpx_codec_frame_buffer* fb) {
123 RTC_DCHECK(user_priv); 123 RTC_DCHECK(user_priv);
124 RTC_DCHECK(fb); 124 RTC_DCHECK(fb);
125 Vp9FrameBuffer* buffer = static_cast<Vp9FrameBuffer*>(fb->priv); 125 Vp9FrameBuffer* buffer = static_cast<Vp9FrameBuffer*>(fb->priv);
126 if (buffer != nullptr) { 126 if (buffer != nullptr) {
127 buffer->Release(); 127 buffer->Release();
128 // When libvpx fails to decode and you continue to try to decode (and fail) 128 // When libvpx fails to decode and you continue to try to decode (and fail)
129 // libvpx can for some reason try to release the same buffer multiple times. 129 // libvpx can for some reason try to release the same buffer multiple times.
130 // Setting |priv| to null protects against trying to Release multiple times. 130 // Setting |priv| to null protects against trying to Release multiple times.
131 fb->priv = nullptr; 131 fb->priv = nullptr;
132 } 132 }
133 return 0; 133 return 0;
134 } 134 }
135 135
136 } // namespace webrtc 136 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h ('k') | webrtc/p2p/base/asyncstuntcpsocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698