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

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

Issue 1826583003: MSE: Record counts of detected MSE audio, video and text tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another attempt to fix that link failure. MEDIA_EXPORT should do it! Created 4 years, 8 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/chunk_demuxer.h ('k') | media/formats/mp2t/mp2t_stream_parser.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/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/metrics/histogram_macros.h"
16 #include "base/stl_util.h" 17 #include "base/stl_util.h"
17 #include "media/base/audio_decoder_config.h" 18 #include "media/base/audio_decoder_config.h"
18 #include "media/base/bind_to_current_loop.h" 19 #include "media/base/bind_to_current_loop.h"
19 #include "media/base/stream_parser_buffer.h" 20 #include "media/base/stream_parser_buffer.h"
20 #include "media/base/timestamp_constants.h" 21 #include "media/base/timestamp_constants.h"
21 #include "media/base/video_decoder_config.h" 22 #include "media/base/video_decoder_config.h"
22 #include "media/filters/frame_processor.h" 23 #include "media/filters/frame_processor.h"
23 #include "media/filters/stream_parser_factory.h" 24 #include "media/filters/stream_parser_factory.h"
24 25
25 using base::TimeDelta; 26 using base::TimeDelta;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 : state_(WAITING_FOR_INIT), 361 : state_(WAITING_FOR_INIT),
361 cancel_next_seek_(false), 362 cancel_next_seek_(false),
362 host_(NULL), 363 host_(NULL),
363 open_cb_(open_cb), 364 open_cb_(open_cb),
364 encrypted_media_init_data_cb_(encrypted_media_init_data_cb), 365 encrypted_media_init_data_cb_(encrypted_media_init_data_cb),
365 enable_text_(false), 366 enable_text_(false),
366 media_log_(media_log), 367 media_log_(media_log),
367 duration_(kNoTimestamp()), 368 duration_(kNoTimestamp()),
368 user_specified_duration_(-1), 369 user_specified_duration_(-1),
369 liveness_(DemuxerStream::LIVENESS_UNKNOWN), 370 liveness_(DemuxerStream::LIVENESS_UNKNOWN),
370 splice_frames_enabled_(splice_frames_enabled) { 371 splice_frames_enabled_(splice_frames_enabled),
372 detected_audio_track_count_(0),
373 detected_video_track_count_(0),
374 detected_text_track_count_(0) {
371 DCHECK(!open_cb_.is_null()); 375 DCHECK(!open_cb_.is_null());
372 DCHECK(!encrypted_media_init_data_cb_.is_null()); 376 DCHECK(!encrypted_media_init_data_cb_.is_null());
373 } 377 }
374 378
375 std::string ChunkDemuxer::GetDisplayName() const { 379 std::string ChunkDemuxer::GetDisplayName() const {
376 return "ChunkDemuxer"; 380 return "ChunkDemuxer";
377 } 381 }
378 382
379 void ChunkDemuxer::Initialize( 383 void ChunkDemuxer::Initialize(
380 DemuxerHost* host, 384 DemuxerHost* host,
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 timeline_offset_ = params.timeline_offset; 958 timeline_offset_ = params.timeline_offset;
955 } 959 }
956 960
957 if (params.liveness != DemuxerStream::LIVENESS_UNKNOWN) { 961 if (params.liveness != DemuxerStream::LIVENESS_UNKNOWN) {
958 if (audio_) 962 if (audio_)
959 audio_->SetLiveness(params.liveness); 963 audio_->SetLiveness(params.liveness);
960 if (video_) 964 if (video_)
961 video_->SetLiveness(params.liveness); 965 video_->SetLiveness(params.liveness);
962 } 966 }
963 967
968 detected_audio_track_count_ += params.detected_audio_track_count;
969 detected_video_track_count_ += params.detected_video_track_count;
970 detected_text_track_count_ += params.detected_text_track_count;
971
964 // Wait until all streams have initialized. 972 // Wait until all streams have initialized.
973 // TODO(wolenetz): Make this gate less fragile. See https://crbug.com/597447.
965 if ((!source_id_audio_.empty() && !audio_) || 974 if ((!source_id_audio_.empty() && !audio_) ||
966 (!source_id_video_.empty() && !video_)) { 975 (!source_id_video_.empty() && !video_)) {
967 return; 976 return;
968 } 977 }
969 978
979 // Record detected track counts by type corresponding to an MSE playback.
980 // Counts are split into 50 buckets, capped into [0,100] range.
981 UMA_HISTOGRAM_COUNTS_100("Media.MSE.DetectedTrackCount.Audio",
982 detected_audio_track_count_);
983 UMA_HISTOGRAM_COUNTS_100("Media.MSE.DetectedTrackCount.Video",
984 detected_video_track_count_);
985 UMA_HISTOGRAM_COUNTS_100("Media.MSE.DetectedTrackCount.Text",
986 detected_text_track_count_);
987
970 SeekAllSources(GetStartTime()); 988 SeekAllSources(GetStartTime());
971 StartReturningData(); 989 StartReturningData();
972 990
973 if (duration_ == kNoTimestamp()) 991 if (duration_ == kNoTimestamp())
974 duration_ = kInfiniteDuration(); 992 duration_ = kInfiniteDuration();
975 993
976 // The demuxer is now initialized after the |start_timestamp_| was set. 994 // The demuxer is now initialized after the |start_timestamp_| was set.
977 ChangeState_Locked(INITIALIZED); 995 ChangeState_Locked(INITIALIZED);
978 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); 996 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
979 } 997 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1133 }
1116 1134
1117 void ChunkDemuxer::ShutdownAllStreams() { 1135 void ChunkDemuxer::ShutdownAllStreams() {
1118 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); 1136 for (MediaSourceStateMap::iterator itr = source_state_map_.begin();
1119 itr != source_state_map_.end(); ++itr) { 1137 itr != source_state_map_.end(); ++itr) {
1120 itr->second->Shutdown(); 1138 itr->second->Shutdown();
1121 } 1139 }
1122 } 1140 }
1123 1141
1124 } // namespace media 1142 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/formats/mp2t/mp2t_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698