Chromium Code Reviews| 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 "media/gpu/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 |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 // Note that async codec construction might still be in progress. In that | 1409 // Note that async codec construction might still be in progress. In that |
| 1410 // case, the codec will be deleted when it completes once we invalidate all | 1410 // case, the codec will be deleted when it completes once we invalidate all |
| 1411 // our weak refs. | 1411 // our weak refs. |
| 1412 weak_this_factory_.InvalidateWeakPtrs(); | 1412 weak_this_factory_.InvalidateWeakPtrs(); |
| 1413 if (media_codec_) { | 1413 if (media_codec_) { |
| 1414 manager->StopTimer(this); | 1414 manager->StopTimer(this); |
| 1415 // If codec construction is broken, then we can't release this codec if it's | 1415 // If codec construction is broken, then we can't release this codec if it's |
| 1416 // backed by hardware, else it may hang too. Post it to the construction | 1416 // backed by hardware, else it may hang too. Post it to the construction |
| 1417 // thread, and it'll get freed if things start working. If things are | 1417 // thread, and it'll get freed if things start working. If things are |
| 1418 // already working, then it'll be freed soon. | 1418 // already working, then it'll be freed soon. |
| 1419 if (media_codec_->IsSoftwareCodec()) { | 1419 // |
| 1420 // We require software codecs when |allow_autodetection_| is false, so use | |
| 1421 // the stored value as a proxy for whether the MediaCodec is software backed | |
| 1422 // or not. | |
| 1423 if (!codec_config_->allow_autodetection_) { | |
|
liberato (no reviews please)
2016/06/30 14:59:27
it'll leak software codecs when mediaserver first
| |
| 1420 media_codec_.reset(); | 1424 media_codec_.reset(); |
| 1421 } else { | 1425 } else { |
| 1422 manager->ConstructionTaskRunner()->DeleteSoon(FROM_HERE, | 1426 manager->ConstructionTaskRunner()->DeleteSoon(FROM_HERE, |
| 1423 media_codec_.release()); | 1427 media_codec_.release()); |
| 1424 } | 1428 } |
| 1425 } | 1429 } |
| 1426 delete this; | 1430 delete this; |
| 1427 } | 1431 } |
| 1428 | 1432 |
| 1429 bool AndroidVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( | 1433 bool AndroidVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1750 // http://crbug.com/582170 | 1754 // http://crbug.com/582170 |
| 1751 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: | 1755 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
| 1752 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1756 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1753 } | 1757 } |
| 1754 } | 1758 } |
| 1755 | 1759 |
| 1756 return capabilities; | 1760 return capabilities; |
| 1757 } | 1761 } |
| 1758 | 1762 |
| 1759 } // namespace media | 1763 } // namespace media |
| OLD | NEW |