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

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

Issue 2258113002: [AVDA] Use InMilliseconds with presentation_timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/gpu/android_video_decode_accelerator.h ('k') | no next file » | 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) 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 bitstream_buffer.presentation_timestamp(); 699 bitstream_buffer.presentation_timestamp();
700 DCHECK(presentation_timestamp != kNoTimestamp) 700 DCHECK(presentation_timestamp != kNoTimestamp)
701 << "Bitstream buffers must have valid presentation timestamps"; 701 << "Bitstream buffers must have valid presentation timestamps";
702 702
703 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt 703 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt
704 // ref frames, but it's OK to overwrite it because we only expect a single 704 // ref frames, but it's OK to overwrite it because we only expect a single
705 // output frame to have that timestamp. AVDA clients only use the bitstream 705 // output frame to have that timestamp. AVDA clients only use the bitstream
706 // buffer id in the returned Pictures to map a bitstream buffer back to a 706 // buffer id in the returned Pictures to map a bitstream buffer back to a
707 // timestamp on their side, so either one of the bitstream buffer ids will 707 // timestamp on their side, so either one of the bitstream buffer ids will
708 // result in them finding the right timestamp. 708 // result in them finding the right timestamp.
709 bitstream_buffers_in_decoder_[presentation_timestamp] = bitstream_buffer.id(); 709 bitstream_buffers_in_decoder_[presentation_timestamp.InMilliseconds()] = bitst ream_buffer.id();
710 710
711 // Notice that |memory| will be null if we repeatedly enqueue the same buffer, 711 // Notice that |memory| will be null if we repeatedly enqueue the same buffer,
712 // this happens after MEDIA_CODEC_NO_KEY. 712 // this happens after MEDIA_CODEC_NO_KEY.
713 const uint8_t* memory = 713 const uint8_t* memory =
714 shm ? static_cast<const uint8_t*>(shm->memory()) : nullptr; 714 shm ? static_cast<const uint8_t*>(shm->memory()) : nullptr;
715 const std::string& key_id = bitstream_buffer.key_id(); 715 const std::string& key_id = bitstream_buffer.key_id();
716 const std::string& iv = bitstream_buffer.iv(); 716 const std::string& iv = bitstream_buffer.iv();
717 const std::vector<SubsampleEntry>& subsamples = bitstream_buffer.subsamples(); 717 const std::vector<SubsampleEntry>& subsamples = bitstream_buffer.subsamples();
718 718
719 MediaCodecStatus status; 719 MediaCodecStatus status;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 // message, then we might not have any picture buffers to use. This 874 // message, then we might not have any picture buffers to use. This
875 // isn't supposed to happen (see EncodeDecodeTest.java#617). 875 // isn't supposed to happen (see EncodeDecodeTest.java#617).
876 // Log a metric to see how common this is. 876 // Log a metric to see how common this is.
877 RecordFormatChangedMetric(FormatChangedValue::MissingFormatChanged); 877 RecordFormatChangedMetric(FormatChangedValue::MissingFormatChanged);
878 media_codec_->ReleaseOutputBuffer(buf_index, false); 878 media_codec_->ReleaseOutputBuffer(buf_index, false);
879 POST_ERROR(PLATFORM_FAILURE, "Dequeued buffers before FORMAT_CHANGED."); 879 POST_ERROR(PLATFORM_FAILURE, "Dequeued buffers before FORMAT_CHANGED.");
880 return false; 880 return false;
881 } 881 }
882 882
883 // Get the bitstream buffer id from the timestamp. 883 // Get the bitstream buffer id from the timestamp.
884 auto it = bitstream_buffers_in_decoder_.find(presentation_timestamp); 884 auto it = bitstream_buffers_in_decoder_.find(presentation_timestamp.InMillisec onds());
885 885
886 if (it != bitstream_buffers_in_decoder_.end()) { 886 if (it != bitstream_buffers_in_decoder_.end()) {
887 const int32_t bitstream_buffer_id = it->second; 887 const int32_t bitstream_buffer_id = it->second;
888 bitstream_buffers_in_decoder_.erase(bitstream_buffers_in_decoder_.begin(), 888 bitstream_buffers_in_decoder_.erase(bitstream_buffers_in_decoder_.begin(),
889 ++it); 889 ++it);
890 SendDecodedFrameToClient(buf_index, bitstream_buffer_id); 890 SendDecodedFrameToClient(buf_index, bitstream_buffer_id);
891 891
892 // Removes ids former or equal than the id from decoder. Note that 892 // Removes ids former or equal than the id from decoder. Note that
893 // |bitstreams_notified_in_advance_| does not mean bitstream ids in decoder 893 // |bitstreams_notified_in_advance_| does not mean bitstream ids in decoder
894 // because of frame reordering issue. We just maintain this roughly and use 894 // because of frame reordering issue. We just maintain this roughly and use
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 1781
1782 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() 1782 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden()
1783 const { 1783 const {
1784 // Prevent MediaCodec from using its internal software decoders when we have 1784 // Prevent MediaCodec from using its internal software decoders when we have
1785 // more secure and up to date versions in the renderer process. 1785 // more secure and up to date versions in the renderer process.
1786 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 || 1786 return !config_.is_encrypted && (codec_config_->codec_ == media::kCodecVP8 ||
1787 codec_config_->codec_ == media::kCodecVP9); 1787 codec_config_->codec_ == media::kCodecVP9);
1788 } 1788 }
1789 1789
1790 } // namespace media 1790 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/android_video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698