OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <climits> | 8 #include <climits> |
9 | 9 |
10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 base::TimeDelta timestamp) { | 170 base::TimeDelta timestamp) { |
171 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_XRGB && | 171 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_XRGB && |
172 format != PIXEL_FORMAT_UYVY && format != PIXEL_FORMAT_NV12 && | 172 format != PIXEL_FORMAT_UYVY && format != PIXEL_FORMAT_NV12 && |
173 format != PIXEL_FORMAT_I420) { | 173 format != PIXEL_FORMAT_I420) { |
174 LOG(DFATAL) << "Unsupported pixel format supported, got " | 174 LOG(DFATAL) << "Unsupported pixel format supported, got " |
175 << VideoPixelFormatToString(format); | 175 << VideoPixelFormatToString(format); |
176 return nullptr; | 176 return nullptr; |
177 } | 177 } |
178 const StorageType storage = STORAGE_OPAQUE; | 178 const StorageType storage = STORAGE_OPAQUE; |
179 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 179 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
180 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 180 LOG(DFATAL) << __func__ << " Invalid config." |
181 << ConfigToString(format, storage, coded_size, visible_rect, | 181 << ConfigToString(format, storage, coded_size, visible_rect, |
182 natural_size); | 182 natural_size); |
183 return nullptr; | 183 return nullptr; |
184 } | 184 } |
185 | 185 |
186 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size, | 186 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size, |
187 mailbox_holders, mailbox_holder_release_cb, timestamp); | 187 mailbox_holders, mailbox_holder_release_cb, timestamp); |
188 } | 188 } |
189 | 189 |
190 // static | 190 // static |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 const gfx::Size& natural_size, | 225 const gfx::Size& natural_size, |
226 int32_t y_stride, | 226 int32_t y_stride, |
227 int32_t u_stride, | 227 int32_t u_stride, |
228 int32_t v_stride, | 228 int32_t v_stride, |
229 uint8_t* y_data, | 229 uint8_t* y_data, |
230 uint8_t* u_data, | 230 uint8_t* u_data, |
231 uint8_t* v_data, | 231 uint8_t* v_data, |
232 base::TimeDelta timestamp) { | 232 base::TimeDelta timestamp) { |
233 const StorageType storage = STORAGE_UNOWNED_MEMORY; | 233 const StorageType storage = STORAGE_UNOWNED_MEMORY; |
234 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 234 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
235 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 235 LOG(DFATAL) << __func__ << " Invalid config." |
236 << ConfigToString(format, storage, coded_size, visible_rect, | 236 << ConfigToString(format, storage, coded_size, visible_rect, |
237 natural_size); | 237 natural_size); |
238 return nullptr; | 238 return nullptr; |
239 } | 239 } |
240 | 240 |
241 scoped_refptr<VideoFrame> frame(new VideoFrame( | 241 scoped_refptr<VideoFrame> frame(new VideoFrame( |
242 format, storage, coded_size, visible_rect, natural_size, timestamp)); | 242 format, storage, coded_size, visible_rect, natural_size, timestamp)); |
243 frame->strides_[kYPlane] = y_stride; | 243 frame->strides_[kYPlane] = y_stride; |
244 frame->strides_[kUPlane] = u_stride; | 244 frame->strides_[kUPlane] = u_stride; |
245 frame->strides_[kVPlane] = v_stride; | 245 frame->strides_[kVPlane] = v_stride; |
(...skipping 14 matching lines...) Expand all Loading... |
260 int32_t v_stride, | 260 int32_t v_stride, |
261 uint8_t* y_data, | 261 uint8_t* y_data, |
262 uint8_t* u_data, | 262 uint8_t* u_data, |
263 uint8_t* v_data, | 263 uint8_t* v_data, |
264 const gfx::GpuMemoryBufferHandle& y_handle, | 264 const gfx::GpuMemoryBufferHandle& y_handle, |
265 const gfx::GpuMemoryBufferHandle& u_handle, | 265 const gfx::GpuMemoryBufferHandle& u_handle, |
266 const gfx::GpuMemoryBufferHandle& v_handle, | 266 const gfx::GpuMemoryBufferHandle& v_handle, |
267 base::TimeDelta timestamp) { | 267 base::TimeDelta timestamp) { |
268 const StorageType storage = STORAGE_GPU_MEMORY_BUFFERS; | 268 const StorageType storage = STORAGE_GPU_MEMORY_BUFFERS; |
269 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 269 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
270 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 270 LOG(DFATAL) << __func__ << " Invalid config." |
271 << ConfigToString(format, storage, coded_size, visible_rect, | 271 << ConfigToString(format, storage, coded_size, visible_rect, |
272 natural_size); | 272 natural_size); |
273 return nullptr; | 273 return nullptr; |
274 } | 274 } |
275 | 275 |
276 scoped_refptr<VideoFrame> frame(new VideoFrame( | 276 scoped_refptr<VideoFrame> frame(new VideoFrame( |
277 format, storage, coded_size, visible_rect, natural_size, timestamp)); | 277 format, storage, coded_size, visible_rect, natural_size, timestamp)); |
278 frame->strides_[kYPlane] = y_stride; | 278 frame->strides_[kYPlane] = y_stride; |
279 frame->strides_[kUPlane] = u_stride; | 279 frame->strides_[kUPlane] = u_stride; |
280 frame->strides_[kVPlane] = v_stride; | 280 frame->strides_[kVPlane] = v_stride; |
(...skipping 16 matching lines...) Expand all Loading... |
297 int32_t u_stride, | 297 int32_t u_stride, |
298 int32_t v_stride, | 298 int32_t v_stride, |
299 int32_t a_stride, | 299 int32_t a_stride, |
300 uint8_t* y_data, | 300 uint8_t* y_data, |
301 uint8_t* u_data, | 301 uint8_t* u_data, |
302 uint8_t* v_data, | 302 uint8_t* v_data, |
303 uint8_t* a_data, | 303 uint8_t* a_data, |
304 base::TimeDelta timestamp) { | 304 base::TimeDelta timestamp) { |
305 const StorageType storage = STORAGE_UNOWNED_MEMORY; | 305 const StorageType storage = STORAGE_UNOWNED_MEMORY; |
306 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 306 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
307 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 307 LOG(DFATAL) << __func__ << " Invalid config." |
308 << ConfigToString(format, storage, coded_size, visible_rect, | 308 << ConfigToString(format, storage, coded_size, visible_rect, |
309 natural_size); | 309 natural_size); |
310 return nullptr; | 310 return nullptr; |
311 } | 311 } |
312 | 312 |
313 if (NumPlanes(format) != 4) { | 313 if (NumPlanes(format) != 4) { |
314 LOG(DFATAL) << "Expecting Y, U, V and A planes to be present for the video" | 314 LOG(DFATAL) << "Expecting Y, U, V and A planes to be present for the video" |
315 << " format."; | 315 << " format."; |
316 return nullptr; | 316 return nullptr; |
317 } | 317 } |
(...skipping 15 matching lines...) Expand all Loading... |
333 // static | 333 // static |
334 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( | 334 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( |
335 VideoPixelFormat format, | 335 VideoPixelFormat format, |
336 const gfx::Size& coded_size, | 336 const gfx::Size& coded_size, |
337 const gfx::Rect& visible_rect, | 337 const gfx::Rect& visible_rect, |
338 const gfx::Size& natural_size, | 338 const gfx::Size& natural_size, |
339 const std::vector<int>& dmabuf_fds, | 339 const std::vector<int>& dmabuf_fds, |
340 base::TimeDelta timestamp) { | 340 base::TimeDelta timestamp) { |
341 const StorageType storage = STORAGE_DMABUFS; | 341 const StorageType storage = STORAGE_DMABUFS; |
342 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 342 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
343 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 343 LOG(DFATAL) << __func__ << " Invalid config." |
344 << ConfigToString(format, storage, coded_size, visible_rect, | 344 << ConfigToString(format, storage, coded_size, visible_rect, |
345 natural_size); | 345 natural_size); |
346 return nullptr; | 346 return nullptr; |
347 } | 347 } |
348 | 348 |
349 gpu::MailboxHolder mailbox_holders[kMaxPlanes]; | 349 gpu::MailboxHolder mailbox_holders[kMaxPlanes]; |
350 scoped_refptr<VideoFrame> frame = | 350 scoped_refptr<VideoFrame> frame = |
351 new VideoFrame(format, storage, coded_size, visible_rect, natural_size, | 351 new VideoFrame(format, storage, coded_size, visible_rect, natural_size, |
352 mailbox_holders, ReleaseMailboxCB(), timestamp); | 352 mailbox_holders, ReleaseMailboxCB(), timestamp); |
353 if (!frame || !frame->DuplicateFileDescriptors(dmabuf_fds)) { | 353 if (!frame || !frame->DuplicateFileDescriptors(dmabuf_fds)) { |
354 LOG(DFATAL) << __FUNCTION__ << " Couldn't duplicate fds."; | 354 LOG(DFATAL) << __func__ << " Couldn't duplicate fds."; |
355 return nullptr; | 355 return nullptr; |
356 } | 356 } |
357 return frame; | 357 return frame; |
358 } | 358 } |
359 #endif | 359 #endif |
360 | 360 |
361 #if defined(OS_MACOSX) | 361 #if defined(OS_MACOSX) |
362 // static | 362 // static |
363 scoped_refptr<VideoFrame> VideoFrame::WrapCVPixelBuffer( | 363 scoped_refptr<VideoFrame> VideoFrame::WrapCVPixelBuffer( |
364 CVPixelBufferRef cv_pixel_buffer, | 364 CVPixelBufferRef cv_pixel_buffer, |
(...skipping 16 matching lines...) Expand all Loading... |
381 LOG(DFATAL) << "CVPixelBuffer format not supported: " << cv_format; | 381 LOG(DFATAL) << "CVPixelBuffer format not supported: " << cv_format; |
382 return nullptr; | 382 return nullptr; |
383 } | 383 } |
384 | 384 |
385 const gfx::Size coded_size(CVImageBufferGetEncodedSize(cv_pixel_buffer)); | 385 const gfx::Size coded_size(CVImageBufferGetEncodedSize(cv_pixel_buffer)); |
386 const gfx::Rect visible_rect(CVImageBufferGetCleanRect(cv_pixel_buffer)); | 386 const gfx::Rect visible_rect(CVImageBufferGetCleanRect(cv_pixel_buffer)); |
387 const gfx::Size natural_size(CVImageBufferGetDisplaySize(cv_pixel_buffer)); | 387 const gfx::Size natural_size(CVImageBufferGetDisplaySize(cv_pixel_buffer)); |
388 const StorageType storage = STORAGE_UNOWNED_MEMORY; | 388 const StorageType storage = STORAGE_UNOWNED_MEMORY; |
389 | 389 |
390 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 390 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
391 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 391 LOG(DFATAL) << __func__ << " Invalid config." |
392 << ConfigToString(format, storage, coded_size, visible_rect, | 392 << ConfigToString(format, storage, coded_size, visible_rect, |
393 natural_size); | 393 natural_size); |
394 return nullptr; | 394 return nullptr; |
395 } | 395 } |
396 | 396 |
397 scoped_refptr<VideoFrame> frame(new VideoFrame( | 397 scoped_refptr<VideoFrame> frame(new VideoFrame( |
398 format, storage, coded_size, visible_rect, natural_size, timestamp)); | 398 format, storage, coded_size, visible_rect, natural_size, timestamp)); |
399 | 399 |
400 frame->cv_pixel_buffer_.reset(cv_pixel_buffer, base::scoped_policy::RETAIN); | 400 frame->cv_pixel_buffer_.reset(cv_pixel_buffer, base::scoped_policy::RETAIN); |
401 return frame; | 401 return frame; |
402 } | 402 } |
403 #endif | 403 #endif |
404 | 404 |
405 // static | 405 // static |
406 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( | 406 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( |
407 const scoped_refptr<VideoFrame>& frame, | 407 const scoped_refptr<VideoFrame>& frame, |
408 VideoPixelFormat format, | 408 VideoPixelFormat format, |
409 const gfx::Rect& visible_rect, | 409 const gfx::Rect& visible_rect, |
410 const gfx::Size& natural_size) { | 410 const gfx::Size& natural_size) { |
411 // Frames with textures need mailbox info propagated, and there's no support | 411 // Frames with textures need mailbox info propagated, and there's no support |
412 // for that here yet, see http://crbug/362521. | 412 // for that here yet, see http://crbug/362521. |
413 CHECK(!frame->HasTextures()); | 413 CHECK(!frame->HasTextures()); |
414 DCHECK(frame->visible_rect().Contains(visible_rect)); | 414 DCHECK(frame->visible_rect().Contains(visible_rect)); |
415 | 415 |
416 if (!AreValidPixelFormatsForWrap(frame->format(), format)) { | 416 if (!AreValidPixelFormatsForWrap(frame->format(), format)) { |
417 LOG(DFATAL) << __FUNCTION__ << " Invalid format conversion." | 417 LOG(DFATAL) << __func__ << " Invalid format conversion." |
418 << VideoPixelFormatToString(frame->format()) << " to " | 418 << VideoPixelFormatToString(frame->format()) << " to " |
419 << VideoPixelFormatToString(format); | 419 << VideoPixelFormatToString(format); |
420 return nullptr; | 420 return nullptr; |
421 } | 421 } |
422 | 422 |
423 if (!IsValidConfig(format, frame->storage_type(), frame->coded_size(), | 423 if (!IsValidConfig(format, frame->storage_type(), frame->coded_size(), |
424 visible_rect, natural_size)) { | 424 visible_rect, natural_size)) { |
425 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 425 LOG(DFATAL) << __func__ << " Invalid config." |
426 << ConfigToString(format, frame->storage_type(), | 426 << ConfigToString(format, frame->storage_type(), |
427 frame->coded_size(), visible_rect, | 427 frame->coded_size(), visible_rect, |
428 natural_size); | 428 natural_size); |
429 return nullptr; | 429 return nullptr; |
430 } | 430 } |
431 | 431 |
432 scoped_refptr<VideoFrame> wrapping_frame( | 432 scoped_refptr<VideoFrame> wrapping_frame( |
433 new VideoFrame(format, frame->storage_type(), frame->coded_size(), | 433 new VideoFrame(format, frame->storage_type(), frame->coded_size(), |
434 visible_rect, natural_size, frame->timestamp())); | 434 visible_rect, natural_size, frame->timestamp())); |
435 | 435 |
436 // Copy all metadata to the wrapped frame. | 436 // Copy all metadata to the wrapped frame. |
437 wrapping_frame->metadata()->MergeMetadataFrom(frame->metadata()); | 437 wrapping_frame->metadata()->MergeMetadataFrom(frame->metadata()); |
438 | 438 |
439 for (size_t i = 0; i < NumPlanes(format); ++i) { | 439 for (size_t i = 0; i < NumPlanes(format); ++i) { |
440 wrapping_frame->strides_[i] = frame->stride(i); | 440 wrapping_frame->strides_[i] = frame->stride(i); |
441 wrapping_frame->data_[i] = frame->data(i); | 441 wrapping_frame->data_[i] = frame->data(i); |
442 } | 442 } |
443 | 443 |
444 #if defined(OS_LINUX) | 444 #if defined(OS_LINUX) |
445 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. | 445 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. |
446 if (frame->storage_type() == STORAGE_DMABUFS) { | 446 if (frame->storage_type() == STORAGE_DMABUFS) { |
447 std::vector<int> original_fds; | 447 std::vector<int> original_fds; |
448 for (size_t i = 0; i < kMaxPlanes; ++i) | 448 for (size_t i = 0; i < kMaxPlanes; ++i) |
449 original_fds.push_back(frame->dmabuf_fd(i)); | 449 original_fds.push_back(frame->dmabuf_fd(i)); |
450 if (!wrapping_frame->DuplicateFileDescriptors(original_fds)) { | 450 if (!wrapping_frame->DuplicateFileDescriptors(original_fds)) { |
451 LOG(DFATAL) << __FUNCTION__ << " Couldn't duplicate fds."; | 451 LOG(DFATAL) << __func__ << " Couldn't duplicate fds."; |
452 return nullptr; | 452 return nullptr; |
453 } | 453 } |
454 } | 454 } |
455 #endif | 455 #endif |
456 | 456 |
457 if (frame->storage_type() == STORAGE_SHMEM) | 457 if (frame->storage_type() == STORAGE_SHMEM) |
458 wrapping_frame->AddSharedMemoryHandle(frame->shared_memory_handle_); | 458 wrapping_frame->AddSharedMemoryHandle(frame->shared_memory_handle_); |
459 | 459 |
460 return wrapping_frame; | 460 return wrapping_frame; |
461 } | 461 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // maintained by the general compositor team. Please contact | 508 // maintained by the general compositor team. Please contact |
509 // wonsik@chromium.org . | 509 // wonsik@chromium.org . |
510 | 510 |
511 // static | 511 // static |
512 scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( | 512 scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( |
513 const gfx::Size& size) { | 513 const gfx::Size& size) { |
514 const VideoPixelFormat format = PIXEL_FORMAT_UNKNOWN; | 514 const VideoPixelFormat format = PIXEL_FORMAT_UNKNOWN; |
515 const StorageType storage = STORAGE_HOLE; | 515 const StorageType storage = STORAGE_HOLE; |
516 const gfx::Rect visible_rect = gfx::Rect(size); | 516 const gfx::Rect visible_rect = gfx::Rect(size); |
517 if (!IsValidConfig(format, storage, size, visible_rect, size)) { | 517 if (!IsValidConfig(format, storage, size, visible_rect, size)) { |
518 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 518 LOG(DFATAL) << __func__ << " Invalid config." |
519 << ConfigToString(format, storage, size, visible_rect, size); | 519 << ConfigToString(format, storage, size, visible_rect, size); |
520 return nullptr; | 520 return nullptr; |
521 } | 521 } |
522 scoped_refptr<VideoFrame> frame(new VideoFrame( | 522 scoped_refptr<VideoFrame> frame(new VideoFrame( |
523 format, storage, size, gfx::Rect(size), size, base::TimeDelta())); | 523 format, storage, size, gfx::Rect(size), size, base::TimeDelta())); |
524 return frame; | 524 return frame; |
525 } | 525 } |
526 #endif // defined(VIDEO_HOLE) | 526 #endif // defined(VIDEO_HOLE) |
527 | 527 |
528 // static | 528 // static |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // TODO(miu): This function should support any pixel format. | 816 // TODO(miu): This function should support any pixel format. |
817 // http://crbug.com/555909 | 817 // http://crbug.com/555909 |
818 if (format != PIXEL_FORMAT_I420) { | 818 if (format != PIXEL_FORMAT_I420) { |
819 LOG(DFATAL) << "Only PIXEL_FORMAT_I420 format supported: " | 819 LOG(DFATAL) << "Only PIXEL_FORMAT_I420 format supported: " |
820 << VideoPixelFormatToString(format); | 820 << VideoPixelFormatToString(format); |
821 return nullptr; | 821 return nullptr; |
822 } | 822 } |
823 | 823 |
824 if (!IsValidConfig(format, storage_type, coded_size, visible_rect, | 824 if (!IsValidConfig(format, storage_type, coded_size, visible_rect, |
825 natural_size)) { | 825 natural_size)) { |
826 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 826 LOG(DFATAL) << __func__ << " Invalid config." |
827 << ConfigToString(format, storage_type, coded_size, | 827 << ConfigToString(format, storage_type, coded_size, |
828 visible_rect, natural_size); | 828 visible_rect, natural_size); |
829 return nullptr; | 829 return nullptr; |
830 } | 830 } |
831 | 831 |
832 scoped_refptr<VideoFrame> frame; | 832 scoped_refptr<VideoFrame> frame; |
833 if (storage_type == STORAGE_SHMEM) { | 833 if (storage_type == STORAGE_SHMEM) { |
834 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, | 834 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, |
835 natural_size, timestamp, handle, data_offset); | 835 natural_size, timestamp, handle, data_offset); |
836 } else { | 836 } else { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 } | 982 } |
983 | 983 |
984 // Since we're creating a new YUV frame (and allocating memory for it | 984 // Since we're creating a new YUV frame (and allocating memory for it |
985 // ourselves), we can pad the requested |coded_size| if necessary if the | 985 // ourselves), we can pad the requested |coded_size| if necessary if the |
986 // request does not line up on sample boundaries. See discussion at | 986 // request does not line up on sample boundaries. See discussion at |
987 // http://crrev.com/1240833003 | 987 // http://crrev.com/1240833003 |
988 const gfx::Size new_coded_size = DetermineAlignedSize(format, coded_size); | 988 const gfx::Size new_coded_size = DetermineAlignedSize(format, coded_size); |
989 const StorageType storage = STORAGE_OWNED_MEMORY; | 989 const StorageType storage = STORAGE_OWNED_MEMORY; |
990 if (!IsValidConfig(format, storage, new_coded_size, visible_rect, | 990 if (!IsValidConfig(format, storage, new_coded_size, visible_rect, |
991 natural_size)) { | 991 natural_size)) { |
992 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 992 LOG(DFATAL) << __func__ << " Invalid config." |
993 << ConfigToString(format, storage, coded_size, visible_rect, | 993 << ConfigToString(format, storage, coded_size, visible_rect, |
994 natural_size); | 994 natural_size); |
995 return nullptr; | 995 return nullptr; |
996 } | 996 } |
997 | 997 |
998 scoped_refptr<VideoFrame> frame(new VideoFrame( | 998 scoped_refptr<VideoFrame> frame(new VideoFrame( |
999 format, storage, new_coded_size, visible_rect, natural_size, timestamp)); | 999 format, storage, new_coded_size, visible_rect, natural_size, timestamp)); |
1000 frame->AllocateYUV(zero_initialize_memory); | 1000 frame->AllocateYUV(zero_initialize_memory); |
1001 return frame; | 1001 return frame; |
1002 } | 1002 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 if (zero_initialize_memory) | 1130 if (zero_initialize_memory) |
1131 memset(data, 0, data_size); | 1131 memset(data, 0, data_size); |
1132 | 1132 |
1133 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1133 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
1134 data_[plane] = data + offset[plane]; | 1134 data_[plane] = data + offset[plane]; |
1135 | 1135 |
1136 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1136 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
1137 } | 1137 } |
1138 | 1138 |
1139 } // namespace media | 1139 } // namespace media |
OLD | NEW |