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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 2643333002: Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Created 3 years, 11 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 | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/stream_parser_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <array> 8 #include <array>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "gpu/command_buffer/common/mailbox_holder.h" 23 #include "gpu/command_buffer/common/mailbox_holder.h"
24 #include "media/base/bind_to_current_loop.h" 24 #include "media/base/bind_to_current_loop.h"
25 #include "media/base/cdm_context.h" 25 #include "media/base/cdm_context.h"
26 #include "media/base/decoder_buffer.h" 26 #include "media/base/decoder_buffer.h"
27 #include "media/base/media_log.h" 27 #include "media/base/media_log.h"
28 #include "media/base/media_switches.h" 28 #include "media/base/media_switches.h"
29 #include "media/base/pipeline_status.h" 29 #include "media/base/pipeline_status.h"
30 #include "media/base/surface_manager.h" 30 #include "media/base/surface_manager.h"
31 #include "media/base/video_decoder_config.h" 31 #include "media/base/video_decoder_config.h"
32 #include "media/media_features.h"
32 #include "media/renderers/gpu_video_accelerator_factories.h" 33 #include "media/renderers/gpu_video_accelerator_factories.h"
33 #include "third_party/skia/include/core/SkBitmap.h" 34 #include "third_party/skia/include/core/SkBitmap.h"
34 35
35 #if defined(USE_PROPRIETARY_CODECS) 36 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
36 #include "media/formats/mp4/box_definitions.h" 37 #include "media/formats/mp4/box_definitions.h"
37 #endif 38 #endif
38 39
39 #if defined(OS_ANDROID) 40 #if defined(OS_ANDROID)
40 #include "base/android/build_info.h" 41 #include "base/android/build_info.h"
41 #endif 42 #endif
42 43
43 namespace media { 44 namespace media {
44 namespace { 45 namespace {
45 46
46 // Size of shared-memory segments we allocate. Since we reuse them we let them 47 // Size of shared-memory segments we allocate. Since we reuse them we let them
47 // be on the beefy side. 48 // be on the beefy side.
48 static const size_t kSharedMemorySegmentBytes = 100 << 10; 49 static const size_t kSharedMemorySegmentBytes = 100 << 10;
49 50
50 #if defined(OS_ANDROID) && defined(USE_PROPRIETARY_CODECS) 51 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
51 // Extract the SPS and PPS lists from |extra_data|. Each SPS and PPS is prefixed 52 // Extract the SPS and PPS lists from |extra_data|. Each SPS and PPS is prefixed
52 // with 0x0001, the Annex B framing bytes. The out parameters are not modified 53 // with 0x0001, the Annex B framing bytes. The out parameters are not modified
53 // on failure. 54 // on failure.
54 void ExtractSpsAndPps(const std::vector<uint8_t>& extra_data, 55 void ExtractSpsAndPps(const std::vector<uint8_t>& extra_data,
55 std::vector<uint8_t>* sps_out, 56 std::vector<uint8_t>* sps_out,
56 std::vector<uint8_t>* pps_out) { 57 std::vector<uint8_t>* pps_out) {
57 if (extra_data.empty()) 58 if (extra_data.empty())
58 return; 59 return;
59 60
60 mp4::AVCDecoderConfigurationRecord record; 61 mp4::AVCDecoderConfigurationRecord record;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 DCHECK(!vda_initialized_); 359 DCHECK(!vda_initialized_);
359 360
360 VideoDecodeAccelerator::Config vda_config; 361 VideoDecodeAccelerator::Config vda_config;
361 vda_config.profile = config_.profile(); 362 vda_config.profile = config_.profile();
362 vda_config.cdm_id = cdm_id_; 363 vda_config.cdm_id = cdm_id_;
363 vda_config.surface_id = surface_id; 364 vda_config.surface_id = surface_id;
364 vda_config.encryption_scheme = config_.encryption_scheme(); 365 vda_config.encryption_scheme = config_.encryption_scheme();
365 vda_config.is_deferred_initialization_allowed = true; 366 vda_config.is_deferred_initialization_allowed = true;
366 vda_config.initial_expected_coded_size = config_.coded_size(); 367 vda_config.initial_expected_coded_size = config_.coded_size();
367 368
368 #if defined(OS_ANDROID) && defined(USE_PROPRIETARY_CODECS) 369 #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
369 // We pass the SPS and PPS on Android because it lets us initialize 370 // We pass the SPS and PPS on Android because it lets us initialize
370 // MediaCodec more reliably (http://crbug.com/649185). 371 // MediaCodec more reliably (http://crbug.com/649185).
371 if (config_.codec() == kCodecH264) 372 if (config_.codec() == kCodecH264)
372 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps); 373 ExtractSpsAndPps(config_.extra_data(), &vda_config.sps, &vda_config.pps);
373 #endif 374 #endif
374 375
375 vda_initialized_ = true; 376 vda_initialized_ = true;
376 if (!vda_->Initialize(vda_config, this)) { 377 if (!vda_->Initialize(vda_config, this)) {
377 DVLOG(1) << "VDA::Initialize failed."; 378 DVLOG(1) << "VDA::Initialize failed.";
378 // It's important to set |vda_| to null so that OnSurfaceAvailable() will 379 // It's important to set |vda_| to null so that OnSurfaceAvailable() will
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 } 912 }
912 return false; 913 return false;
913 } 914 }
914 915
915 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 916 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
916 const { 917 const {
917 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 918 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
918 } 919 }
919 920
920 } // namespace media 921 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/stream_parser_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698