OLD | NEW |
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 "content/common/gpu/media/android_video_decode_accelerator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 // Tell the strategy that we're changing codecs. The codec itself could be | 945 // Tell the strategy that we're changing codecs. The codec itself could be |
946 // used normally, since we don't replace it until we're back on the main | 946 // used normally, since we don't replace it until we're back on the main |
947 // thread. However, if we're using an output surface, then the incoming codec | 947 // thread. However, if we're using an output surface, then the incoming codec |
948 // might access that surface while the main thread is drawing. Telling the | 948 // might access that surface while the main thread is drawing. Telling the |
949 // strategy to forget the codec avoids this. | 949 // strategy to forget the codec avoids this. |
950 if (media_codec_) { | 950 if (media_codec_) { |
951 media_codec_.reset(); | 951 media_codec_.reset(); |
952 strategy_->CodecChanged(nullptr, output_picture_buffers_); | 952 strategy_->CodecChanged(nullptr, output_picture_buffers_); |
953 } | 953 } |
954 | 954 |
| 955 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| 956 g_avda_timer.Pointer()->ConstructionTaskRunner(); |
| 957 CHECK(task_runner); |
| 958 |
955 base::PostTaskAndReplyWithResult( | 959 base::PostTaskAndReplyWithResult( |
956 g_avda_timer.Pointer()->ConstructionTaskRunner().get(), FROM_HERE, | 960 task_runner.get(), FROM_HERE, |
957 base::Bind(&AndroidVideoDecodeAccelerator::ConfigureMediaCodecOnAnyThread, | 961 base::Bind(&AndroidVideoDecodeAccelerator::ConfigureMediaCodecOnAnyThread, |
958 codec_config_), | 962 codec_config_), |
959 base::Bind(&AndroidVideoDecodeAccelerator::OnCodecConfigured, | 963 base::Bind(&AndroidVideoDecodeAccelerator::OnCodecConfigured, |
960 weak_this_factory_.GetWeakPtr())); | 964 weak_this_factory_.GetWeakPtr())); |
961 } | 965 } |
962 | 966 |
963 bool AndroidVideoDecodeAccelerator::ConfigureMediaCodecSynchronously() { | 967 bool AndroidVideoDecodeAccelerator::ConfigureMediaCodecSynchronously() { |
964 state_ = WAITING_FOR_CODEC; | 968 state_ = WAITING_FOR_CODEC; |
965 std::unique_ptr<media::VideoCodecBridge> media_codec = | 969 std::unique_ptr<media::VideoCodecBridge> media_codec = |
966 ConfigureMediaCodecOnAnyThread(codec_config_); | 970 ConfigureMediaCodecOnAnyThread(codec_config_); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { | 1347 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { |
1344 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: | 1348 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
1345 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1349 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
1346 } | 1350 } |
1347 } | 1351 } |
1348 | 1352 |
1349 return capabilities; | 1353 return capabilities; |
1350 } | 1354 } |
1351 | 1355 |
1352 } // namespace content | 1356 } // namespace content |
OLD | NEW |