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

Side by Side Diff: content/browser/media/media_internals.cc

Issue 1236543007: MSE: Log buffered audio splice generation to media-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 "content/browser/media/media_internals.h" 5 #include "content/browser/media/media_internals.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 const size_t kMaxNumEvents = 128; 634 const size_t kMaxNumEvents = 128;
635 635
636 // Do not save instantaneous events that happen frequently and have little 636 // Do not save instantaneous events that happen frequently and have little
637 // value in the future. 637 // value in the future.
638 if (event.type == media::MediaLogEvent::NETWORK_ACTIVITY_SET || 638 if (event.type == media::MediaLogEvent::NETWORK_ACTIVITY_SET ||
639 event.type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED) { 639 event.type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED) {
640 return; 640 return;
641 } 641 }
642 642
643 auto& pending_events = pending_events_map_[process_id]; 643 auto& pending_events = pending_events_map_[process_id];
644
645 // Only save the most recent audio splicer statistics, if any. If the new
646 // event updates the statistics, then remove at most one previously saved
647 // statistics event.
648 if (event.type ==
649 media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED) {
650 for (auto iter = pending_events.begin(); iter != pending_events.end();
wolenetz 2015/07/14 23:23:37 This isn't a very efficient mechanism for enforcin
DaleCurtis 2015/07/14 23:37:47 I think you want to do something similar to what R
xhwang 2015/07/15 00:46:50 Maybe it's time to drop all DEBUG logs when the UI
651 ++iter) {
652 if (iter->type ==
653 media::MediaLogEvent::BUFFERED_AUDIO_SPLICE_STATISTICS_CHANGED) {
654 pending_events.erase(iter);
655 break;
656 }
657 }
658 }
659
644 // TODO(xhwang): Notify user that some old logs could have been truncated. 660 // TODO(xhwang): Notify user that some old logs could have been truncated.
645 // See http://crbug.com/498520 661 // See http://crbug.com/498520
646 if (pending_events.size() >= kMaxNumEvents) 662 if (pending_events.size() >= kMaxNumEvents)
647 pending_events.pop_front(); 663 pending_events.pop_front();
648 pending_events.push_back(event); 664 pending_events.push_back(event);
649 } 665 }
650 666
651 void MediaInternals::UpdateAudioLog(AudioLogUpdateType type, 667 void MediaInternals::UpdateAudioLog(AudioLogUpdateType type,
652 const std::string& cache_key, 668 const std::string& cache_key,
653 const std::string& function, 669 const std::string& function,
(...skipping 15 matching lines...) Expand all
669 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); 685 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict));
670 existing_dict->MergeDictionary(value); 686 existing_dict->MergeDictionary(value);
671 } 687 }
672 } 688 }
673 689
674 if (CanUpdate()) 690 if (CanUpdate())
675 SendUpdate(SerializeUpdate(function, value)); 691 SendUpdate(SerializeUpdate(function, value));
676 } 692 }
677 693
678 } // namespace content 694 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/resources/media/main.js » ('j') | content/browser/resources/media/main.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698