OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/callback_helpers.h" | 16 #include "base/callback_helpers.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/debug/alias.h" | 18 #include "base/debug/alias.h" |
19 #include "base/debug/crash_logging.h" | 19 #include "base/debug/crash_logging.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
23 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
24 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
25 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
27 #include "cc/blink/web_layer_impl.h" | 28 #include "cc/blink/web_layer_impl.h" |
28 #include "cc/layers/video_layer.h" | 29 #include "cc/layers/video_layer.h" |
29 #include "gpu/blink/webgraphicscontext3d_impl.h" | 30 #include "gpu/blink/webgraphicscontext3d_impl.h" |
30 #include "media/audio/null_audio_sink.h" | 31 #include "media/audio/null_audio_sink.h" |
31 #include "media/base/bind_to_current_loop.h" | 32 #include "media/base/bind_to_current_loop.h" |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 scoped_ptr<MediaTracks> tracks) { | 823 scoped_ptr<MediaTracks> tracks) { |
823 // For MSE/chunk_demuxer case the media track updates are handled by | 824 // For MSE/chunk_demuxer case the media track updates are handled by |
824 // WebSourceBufferImpl. | 825 // WebSourceBufferImpl. |
825 DCHECK(demuxer_.get()); | 826 DCHECK(demuxer_.get()); |
826 DCHECK(!chunk_demuxer_); | 827 DCHECK(!chunk_demuxer_); |
827 | 828 |
828 // Report the media track information to blink. | 829 // Report the media track information to blink. |
829 for (const auto& track : tracks->tracks()) { | 830 for (const auto& track : tracks->tracks()) { |
830 if (track->type() == MediaTrack::Audio) { | 831 if (track->type() == MediaTrack::Audio) { |
831 auto track_id = client_->addAudioTrack( | 832 auto track_id = client_->addAudioTrack( |
832 blink::WebString::fromUTF8(track->id()), | 833 blink::WebString::fromUTF8(base::UintToString(track->id())), |
833 blink::WebMediaPlayerClient::AudioTrackKindMain, | 834 blink::WebMediaPlayerClient::AudioTrackKindMain, |
834 blink::WebString::fromUTF8(track->label()), | 835 blink::WebString::fromUTF8(track->label()), |
835 blink::WebString::fromUTF8(track->language()), | 836 blink::WebString::fromUTF8(track->language()), |
836 /*enabled*/ true); | 837 /*enabled*/ true); |
837 (void)track_id; | 838 (void)track_id; |
838 } else if (track->type() == MediaTrack::Video) { | 839 } else if (track->type() == MediaTrack::Video) { |
839 auto track_id = client_->addVideoTrack( | 840 auto track_id = client_->addVideoTrack( |
840 blink::WebString::fromUTF8(track->id()), | 841 blink::WebString::fromUTF8(base::UintToString(track->id())), |
841 blink::WebMediaPlayerClient::VideoTrackKindMain, | 842 blink::WebMediaPlayerClient::VideoTrackKindMain, |
842 blink::WebString::fromUTF8(track->label()), | 843 blink::WebString::fromUTF8(track->label()), |
843 blink::WebString::fromUTF8(track->language()), | 844 blink::WebString::fromUTF8(track->language()), |
844 /*selected*/ true); | 845 /*selected*/ true); |
845 (void)track_id; | 846 (void)track_id; |
846 } else { | 847 } else { |
847 // Text tracks are not supported through this code path yet. | 848 // Text tracks are not supported through this code path yet. |
848 NOTREACHED(); | 849 NOTREACHED(); |
849 } | 850 } |
850 } | 851 } |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1596 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
1596 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1597 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
1597 << ", Demuxer: " << demuxer_memory_usage; | 1598 << ", Demuxer: " << demuxer_memory_usage; |
1598 | 1599 |
1599 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1600 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
1600 last_reported_memory_usage_ = current_memory_usage; | 1601 last_reported_memory_usage_ = current_memory_usage; |
1601 adjust_allocated_memory_cb_.Run(delta); | 1602 adjust_allocated_memory_cb_.Run(delta); |
1602 } | 1603 } |
1603 | 1604 |
1604 } // namespace media | 1605 } // namespace media |
OLD | NEW |