buffer_validation.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_GPU_BUFFER_VALIDATION_H_
  5. #define MEDIA_GPU_BUFFER_VALIDATION_H_
  6. #include "base/callback.h"
  7. #include "base/component_export.h"
  8. #include "media/base/video_types.h"
  9. namespace gfx {
  10. class Size;
  11. struct GpuMemoryBufferHandle;
  12. } // namespace gfx
  13. namespace media {
  14. using GetFileSizeCBForTesting = base::RepeatingCallback<size_t()>;
  15. // Gets the file size of |fd| and writes in |size|. Returns false on failure.
  16. COMPONENT_EXPORT(MEDIA_GPU_BUFFER_VALIDATION)
  17. bool GetFileSize(const int fd, size_t* size);
  18. // Verifies if GpuMemoryBufferHandle is valid.
  19. COMPONENT_EXPORT(MEDIA_GPU_BUFFER_VALIDATION)
  20. bool VerifyGpuMemoryBufferHandle(
  21. media::VideoPixelFormat pixel_format,
  22. const gfx::Size& coded_size,
  23. const gfx::GpuMemoryBufferHandle& gmb_handle,
  24. GetFileSizeCBForTesting file_size_cb_for_testing =
  25. GetFileSizeCBForTesting());
  26. } // namespace media
  27. #endif // MEDIA_GPU_BUFFER_VALIDATION_H_