| OLD | NEW |
| 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" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 memcpy(in_shared_memory_->memory(), data, in_buffer_size); | 114 memcpy(in_shared_memory_->memory(), data, in_buffer_size); |
| 115 | 115 |
| 116 // No need to lock for |in_buffer_id_| since IsDecoding_Locked() is false. | 116 // No need to lock for |in_buffer_id_| since IsDecoding_Locked() is false. |
| 117 in_buffer_id_ = next_bitstream_buffer_id_; | 117 in_buffer_id_ = next_bitstream_buffer_id_; |
| 118 media::BitstreamBuffer in_buffer(in_buffer_id_, in_shared_memory_->handle(), | 118 media::BitstreamBuffer in_buffer(in_buffer_id_, in_shared_memory_->handle(), |
| 119 in_buffer_size); | 119 in_buffer_size); |
| 120 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. | 120 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. |
| 121 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; | 121 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; |
| 122 | 122 |
| 123 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) | 123 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 124 const gfx::Size dimensions = frame_format.frame_size; | 124 const gfx::Size dimensions = frame_format.frame_size; |
| 125 base::SharedMemoryHandle out_handle = out_buffer->AsPlatformFile(); | 125 base::SharedMemoryHandle out_handle = out_buffer->AsPlatformFile(); |
| 126 scoped_refptr<media::VideoFrame> out_frame = | 126 scoped_refptr<media::VideoFrame> out_frame = |
| 127 media::VideoFrame::WrapExternalSharedMemory( | 127 media::VideoFrame::WrapExternalSharedMemory( |
| 128 media::PIXEL_FORMAT_I420, // format | 128 media::PIXEL_FORMAT_I420, // format |
| 129 dimensions, // coded_size | 129 dimensions, // coded_size |
| 130 gfx::Rect(dimensions), // visible_rect | 130 gfx::Rect(dimensions), // visible_rect |
| 131 dimensions, // natural_size | 131 dimensions, // natural_size |
| 132 static_cast<uint8_t*>(out_buffer->data()), // data | 132 static_cast<uint8_t*>(out_buffer->data()), // data |
| 133 out_buffer->mapped_size(), // data_size | 133 out_buffer->mapped_size(), // data_size |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 lock_.AssertAcquired(); | 248 lock_.AssertAcquired(); |
| 249 return !decode_done_closure_.is_null(); | 249 return !decode_done_closure_.is_null(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { | 252 void VideoCaptureGpuJpegDecoder::RecordInitDecodeUMA_Locked() { |
| 253 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", | 253 UMA_HISTOGRAM_BOOLEAN("Media.VideoCaptureGpuJpegDecoder.InitDecodeSuccess", |
| 254 decoder_status_ == INIT_PASSED); | 254 decoder_status_ == INIT_PASSED); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace content | 257 } // namespace content |
| OLD | NEW |