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

Side by Side Diff: content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc

Issue 2860573008: Add more video capture log messages to WebRTC log (Closed)
Patch Set: Incorporate suggestions from PatchSet 1 Created 3 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
« no previous file with comments | « content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" 5 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "media/base/media_switches.h" 21 #include "media/base/media_switches.h"
22 #include "media/base/video_frame.h" 22 #include "media/base/video_frame.h"
23 #include "media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h" 23 #include "media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h"
24 #include "mojo/public/cpp/system/platform_handle.h" 24 #include "mojo/public/cpp/system/platform_handle.h"
25 25
26 namespace content { 26 namespace content {
27 27
28 VideoCaptureGpuJpegDecoder::VideoCaptureGpuJpegDecoder( 28 VideoCaptureGpuJpegDecoder::VideoCaptureGpuJpegDecoder(
29 const DecodeDoneCB& decode_done_cb) 29 DecodeDoneCB decode_done_cb,
30 : decode_done_cb_(decode_done_cb), 30 base::Callback<void(const std::string&)> send_log_message_cb)
31 : decode_done_cb_(std::move(decode_done_cb)),
32 send_log_message_cb_(std::move(send_log_message_cb)),
33 has_received_decoded_frame_(false),
31 next_bitstream_buffer_id_(0), 34 next_bitstream_buffer_id_(0),
32 in_buffer_id_(media::JpegDecodeAccelerator::kInvalidBitstreamBufferId), 35 in_buffer_id_(media::JpegDecodeAccelerator::kInvalidBitstreamBufferId),
33 decoder_status_(INIT_PENDING) {} 36 decoder_status_(INIT_PENDING) {}
34 37
35 VideoCaptureGpuJpegDecoder::~VideoCaptureGpuJpegDecoder() { 38 VideoCaptureGpuJpegDecoder::~VideoCaptureGpuJpegDecoder() {
36 DCHECK(CalledOnValidThread()); 39 DCHECK(CalledOnValidThread());
37 40
38 // |decoder_| guarantees no more JpegDecodeAccelerator::Client callbacks 41 // |decoder_| guarantees no more JpegDecodeAccelerator::Client callbacks
39 // on IO thread after deletion. 42 // on IO thread after deletion.
40 decoder_.reset(); 43 decoder_.reset();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 base::Bind(decode_done_cb_, out_buffer.id, out_buffer.frame_feedback_id, 172 base::Bind(decode_done_cb_, out_buffer.id, out_buffer.frame_feedback_id,
170 base::Passed(&out_buffer.access_permission), 173 base::Passed(&out_buffer.access_permission),
171 base::Passed(&out_frame_info)); 174 base::Passed(&out_frame_info));
172 } 175 }
173 decoder_->Decode(in_buffer, std::move(out_frame)); 176 decoder_->Decode(in_buffer, std::move(out_frame));
174 } 177 }
175 178
176 void VideoCaptureGpuJpegDecoder::VideoFrameReady(int32_t bitstream_buffer_id) { 179 void VideoCaptureGpuJpegDecoder::VideoFrameReady(int32_t bitstream_buffer_id) {
177 DCHECK_CURRENTLY_ON(BrowserThread::IO); 180 DCHECK_CURRENTLY_ON(BrowserThread::IO);
178 TRACE_EVENT0("jpeg", "VideoCaptureGpuJpegDecoder::VideoFrameReady"); 181 TRACE_EVENT0("jpeg", "VideoCaptureGpuJpegDecoder::VideoFrameReady");
182 if (!has_received_decoded_frame_) {
183 send_log_message_cb_.Run("Received decoded frame from Gpu Jpeg decoder");
184 has_received_decoded_frame_ = true;
185 }
179 base::AutoLock lock(lock_); 186 base::AutoLock lock(lock_);
180 187
181 if (!IsDecoding_Locked()) { 188 if (!IsDecoding_Locked()) {
182 LOG(ERROR) << "Got decode response while not decoding"; 189 LOG(ERROR) << "Got decode response while not decoding";
183 return; 190 return;
184 } 191 }
185 192
186 if (bitstream_buffer_id != in_buffer_id_) { 193 if (bitstream_buffer_id != in_buffer_id_) {
187 LOG(ERROR) << "Unexpected bitstream_buffer_id " << bitstream_buffer_id 194 LOG(ERROR) << "Unexpected bitstream_buffer_id " << bitstream_buffer_id
188 << ", expected " << in_buffer_id_; 195 << ", expected " << in_buffer_id_;
189 return; 196 return;
190 } 197 }
191 in_buffer_id_ = media::JpegDecodeAccelerator::kInvalidBitstreamBufferId; 198 in_buffer_id_ = media::JpegDecodeAccelerator::kInvalidBitstreamBufferId;
192 199
193 decode_done_closure_.Run(); 200 decode_done_closure_.Run();
194 decode_done_closure_.Reset(); 201 decode_done_closure_.Reset();
195 202
196 TRACE_EVENT_ASYNC_END0("jpeg", "VideoCaptureGpuJpegDecoder decoding", 203 TRACE_EVENT_ASYNC_END0("jpeg", "VideoCaptureGpuJpegDecoder decoding",
197 bitstream_buffer_id); 204 bitstream_buffer_id);
198 } 205 }
199 206
200 void VideoCaptureGpuJpegDecoder::NotifyError( 207 void VideoCaptureGpuJpegDecoder::NotifyError(
201 int32_t bitstream_buffer_id, 208 int32_t bitstream_buffer_id,
202 media::JpegDecodeAccelerator::Error error) { 209 media::JpegDecodeAccelerator::Error error) {
203 DCHECK_CURRENTLY_ON(BrowserThread::IO); 210 DCHECK_CURRENTLY_ON(BrowserThread::IO);
204 LOG(ERROR) << "Decode error, bitstream_buffer_id=" << bitstream_buffer_id 211 LOG(ERROR) << "Decode error, bitstream_buffer_id=" << bitstream_buffer_id
205 << ", error=" << error; 212 << ", error=" << error;
206 213 send_log_message_cb_.Run("Gpu Jpeg decoder failed");
207 base::AutoLock lock(lock_); 214 base::AutoLock lock(lock_);
208 decode_done_closure_.Reset(); 215 decode_done_closure_.Reset();
209 decoder_status_ = FAILED; 216 decoder_status_ = FAILED;
210 } 217 }
211 218
212 // static 219 // static
213 void VideoCaptureGpuJpegDecoder::EstablishGpuChannelOnUIThread( 220 void VideoCaptureGpuJpegDecoder::EstablishGpuChannelOnUIThread(
214 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 221 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
215 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) { 222 base::WeakPtr<VideoCaptureGpuJpegDecoder> weak_this) {
216 DCHECK_CURRENTLY_ON(BrowserThread::UI); 223 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 lock_.AssertAcquired(); 272 lock_.AssertAcquired();
266 return !decode_done_closure_.is_null(); 273 return !decode_done_closure_.is_null();
267 } 274 }
268 275
269 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { 276 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() {
270 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", 277 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess",
271 decoder_status_ == INIT_PASSED); 278 decoder_status_ == INIT_PASSED);
272 } 279 }
273 280
274 } // namespace content 281 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698