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

Side by Side Diff: media/gpu/android_video_decode_accelerator.cc

Issue 1939683002: Test X11 header pollution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/common/gpu/media/android_video_decode_accelerator.h" 5 #include "media/gpu/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/android/build_info.h" 11 #include "base/android/build_info.h"
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/callback_helpers.h" 15 #include "base/callback_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/message_loop/message_loop.h" 19 #include "base/message_loop/message_loop.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/task_runner_util.h" 21 #include "base/task_runner_util.h"
22 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
23 #include "base/trace_event/trace_event.h" 23 #include "base/trace_event/trace_event.h"
24 #include "content/common/gpu/media/android_copying_backing_strategy.h"
25 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h "
26 #include "content/common/gpu/media/avda_return_on_failure.h"
27 #include "content/common/gpu/media/shared_memory_region.h"
28 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
29 #include "gpu/command_buffer/service/mailbox_manager.h" 25 #include "gpu/command_buffer/service/mailbox_manager.h"
30 #include "gpu/ipc/service/gpu_channel.h" 26 #include "gpu/ipc/service/gpu_channel.h"
31 #include "media/base/android/media_codec_bridge.h" 27 #include "media/base/android/media_codec_bridge.h"
32 #include "media/base/android/media_codec_util.h" 28 #include "media/base/android/media_codec_util.h"
33 #include "media/base/bind_to_current_loop.h" 29 #include "media/base/bind_to_current_loop.h"
34 #include "media/base/bitstream_buffer.h" 30 #include "media/base/bitstream_buffer.h"
35 #include "media/base/limits.h" 31 #include "media/base/limits.h"
36 #include "media/base/media.h" 32 #include "media/base/media.h"
37 #include "media/base/timestamp_constants.h" 33 #include "media/base/timestamp_constants.h"
38 #include "media/base/video_decoder_config.h" 34 #include "media/base/video_decoder_config.h"
35 #include "media/gpu/android_copying_backing_strategy.h"
36 #include "media/gpu/android_deferred_rendering_backing_strategy.h"
37 #include "media/gpu/avda_return_on_failure.h"
38 #include "media/gpu/shared_memory_region.h"
39 #include "media/video/picture.h" 39 #include "media/video/picture.h"
40 #include "ui/gl/android/scoped_java_surface.h" 40 #include "ui/gl/android/scoped_java_surface.h"
41 #include "ui/gl/android/surface_texture.h" 41 #include "ui/gl/android/surface_texture.h"
42 #include "ui/gl/gl_bindings.h" 42 #include "ui/gl/gl_bindings.h"
43 43
44 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) 44 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
45 #include "media/mojo/services/mojo_cdm_service.h" 45 #include "media/mojo/services/mojo_cdm_service.h"
46 #endif 46 #endif
47 47
48 #define POST_ERROR(error_code, error_message) \ 48 #define POST_ERROR(error_code, error_message) \
49 do { \ 49 do { \
50 DLOG(ERROR) << error_message; \ 50 DLOG(ERROR) << error_message; \
51 PostError(FROM_HERE, media::VideoDecodeAccelerator::error_code); \ 51 PostError(FROM_HERE, media::VideoDecodeAccelerator::error_code); \
52 } while (0) 52 } while (0)
53 53
54 namespace content { 54 namespace media {
55 55
56 enum { kNumPictureBuffers = media::limits::kMaxVideoFrames + 1 }; 56 enum { kNumPictureBuffers = media::limits::kMaxVideoFrames + 1 };
57 57
58 // Max number of bitstreams notified to the client with 58 // Max number of bitstreams notified to the client with
59 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. 59 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream.
60 enum { kMaxBitstreamsNotifiedInAdvance = 32 }; 60 enum { kMaxBitstreamsNotifiedInAdvance = 32 };
61 61
62 // MediaCodec is only guaranteed to support baseline, but some devices may 62 // MediaCodec is only guaranteed to support baseline, but some devices may
63 // support others. Advertise support for all H264 profiles and let the 63 // support others. Advertise support for all H264 profiles and let the
64 // MediaCodec fail when decoding if it's not actually supported. It's assumed 64 // MediaCodec fail when decoding if it's not actually supported. It's assumed
65 // that consumers won't have software fallback for H264 on Android anyway. 65 // that consumers won't have software fallback for H264 on Android anyway.
66 static const media::VideoCodecProfile kSupportedH264Profiles[] = { 66 static const media::VideoCodecProfile kSupportedH264Profiles[] = {
67 media::H264PROFILE_BASELINE, 67 media::H264PROFILE_BASELINE,
68 media::H264PROFILE_MAIN, 68 media::H264PROFILE_MAIN,
69 media::H264PROFILE_EXTENDED, 69 media::H264PROFILE_EXTENDED,
70 media::H264PROFILE_HIGH, 70 media::H264PROFILE_HIGH,
71 media::H264PROFILE_HIGH10PROFILE, 71 media::H264PROFILE_HIGH10PROFILE,
72 media::H264PROFILE_HIGH422PROFILE, 72 media::H264PROFILE_HIGH422PROFILE,
73 media::H264PROFILE_HIGH444PREDICTIVEPROFILE, 73 media::H264PROFILE_HIGH444PREDICTIVEPROFILE,
74 media::H264PROFILE_SCALABLEBASELINE, 74 media::H264PROFILE_SCALABLEBASELINE,
75 media::H264PROFILE_SCALABLEHIGH, 75 media::H264PROFILE_SCALABLEHIGH,
76 media::H264PROFILE_STEREOHIGH, 76 media::H264PROFILE_STEREOHIGH,
77 media::H264PROFILE_MULTIVIEWHIGH 77 media::H264PROFILE_MULTIVIEWHIGH};
78 };
79 78
80 // Because MediaCodec is thread-hostile (must be poked on a single thread) and 79 // Because MediaCodec is thread-hostile (must be poked on a single thread) and
81 // has no callback mechanism (b/11990118), we must drive it by polling for 80 // has no callback mechanism (b/11990118), we must drive it by polling for
82 // complete frames (and available input buffers, when the codec is fully 81 // complete frames (and available input buffers, when the codec is fully
83 // saturated). This function defines the polling delay. The value used is an 82 // saturated). This function defines the polling delay. The value used is an
84 // arbitrary choice that trades off CPU utilization (spinning) against latency. 83 // arbitrary choice that trades off CPU utilization (spinning) against latency.
85 // Mirrors android_video_encode_accelerator.cc:EncodePollDelay(). 84 // Mirrors android_video_encode_accelerator.cc:EncodePollDelay().
86 static inline const base::TimeDelta DecodePollDelay() { 85 static inline const base::TimeDelta DecodePollDelay() {
87 // An alternative to this polling scheme could be to dedicate a new thread 86 // An alternative to this polling scheme could be to dedicate a new thread
88 // (instead of using the ChildThread) to run the MediaCodec, and make that 87 // (instead of using the ChildThread) to run the MediaCodec, and make that
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 SUPPORTS_DEFERRED_INITIALIZATION; 1457 SUPPORTS_DEFERRED_INITIALIZATION;
1459 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { 1458 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) {
1460 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: 1459 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities::
1461 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1460 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1462 } 1461 }
1463 } 1462 }
1464 1463
1465 return capabilities; 1464 return capabilities;
1466 } 1465 }
1467 1466
1468 } // namespace content 1467 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/android_video_decode_accelerator.h ('k') | media/gpu/android_video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698