| 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 "content/renderer/media/android/media_source_delegate.h" | 5 #include "content/renderer/media/android/media_source_delegate.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "content/renderer/media/android/renderer_demuxer_android.h" | 13 #include "content/renderer/media/android/renderer_demuxer_android.h" |
| 14 #include "content/renderer/media/webmediaplayer_util.h" | 14 #include "content/renderer/media/webmediaplayer_util.h" |
| 15 #include "content/renderer/media/webmediasource_impl.h" | 15 #include "content/renderer/media/webmediasource_impl.h" |
| 16 #include "media/base/android/demuxer_stream_player_params.h" | 16 #include "media/base/android/demuxer_stream_player_params.h" |
| 17 #include "media/base/bind_to_loop.h" | 17 #include "media/base/bind_to_loop.h" |
| 18 #include "media/base/demuxer_stream.h" | 18 #include "media/base/demuxer_stream.h" |
| 19 #include "media/base/media_log.h" | 19 #include "media/base/media_log.h" |
| 20 #include "media/filters/chunk_demuxer.h" | 20 #include "media/filters/chunk_demuxer.h" |
| 21 #include "media/filters/decrypting_demuxer_stream.h" | 21 #include "media/filters/decrypting_demuxer_stream.h" |
| 22 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 24 | 24 |
| 25 using media::DemuxerStream; | 25 using media::DemuxerStream; |
| 26 using media::DemuxerConfigs; | 26 using media::DemuxerConfigs; |
| 27 using media::DemuxerData; | 27 using media::DemuxerData; |
| 28 using WebKit::WebMediaPlayer; | 28 using blink::WebMediaPlayer; |
| 29 using WebKit::WebString; | 29 using blink::WebString; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // The size of the access unit to transfer in an IPC in case of MediaSource. | 33 // The size of the access unit to transfer in an IPC in case of MediaSource. |
| 34 // 16: approximately 250ms of content in 60 fps movies. | 34 // 16: approximately 250ms of content in 60 fps movies. |
| 35 const size_t kAccessUnitSizeForMediaSource = 16; | 35 const size_t kAccessUnitSizeForMediaSource = 16; |
| 36 | 36 |
| 37 const uint8 kVorbisPadding[] = { 0xff, 0xff, 0xff, 0xff }; | 37 const uint8 kVorbisPadding[] = { 0xff, 0xff, 0xff, 0xff }; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 access_unit_size_ = 1; | 195 access_unit_size_ = 1; |
| 196 | 196 |
| 197 // |this| will be retained until StopDemuxer() is posted, so Unretained() is | 197 // |this| will be retained until StopDemuxer() is posted, so Unretained() is |
| 198 // safe here. | 198 // safe here. |
| 199 media_loop_->PostTask(FROM_HERE, | 199 media_loop_->PostTask(FROM_HERE, |
| 200 base::Bind(&MediaSourceDelegate::InitializeDemuxer, | 200 base::Bind(&MediaSourceDelegate::InitializeDemuxer, |
| 201 base::Unretained(this))); | 201 base::Unretained(this))); |
| 202 } | 202 } |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 const WebKit::WebTimeRanges& MediaSourceDelegate::Buffered() { | 205 const blink::WebTimeRanges& MediaSourceDelegate::Buffered() { |
| 206 buffered_web_time_ranges_ = | 206 buffered_web_time_ranges_ = |
| 207 ConvertToWebTimeRanges(buffered_time_ranges_); | 207 ConvertToWebTimeRanges(buffered_time_ranges_); |
| 208 return buffered_web_time_ranges_; | 208 return buffered_web_time_ranges_; |
| 209 } | 209 } |
| 210 | 210 |
| 211 size_t MediaSourceDelegate::DecodedFrameCount() const { | 211 size_t MediaSourceDelegate::DecodedFrameCount() const { |
| 212 return statistics_.video_frames_decoded; | 212 return statistics_.video_frames_decoded; |
| 213 } | 213 } |
| 214 | 214 |
| 215 size_t MediaSourceDelegate::DroppedFrameCount() const { | 215 size_t MediaSourceDelegate::DroppedFrameCount() const { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 // current time have been garbage collected or removed by the web app, this is | 822 // current time have been garbage collected or removed by the web app, this is |
| 823 // unlikely. This may cause unexpected playback stall due to seek pending an | 823 // unlikely. This may cause unexpected playback stall due to seek pending an |
| 824 // append for a GOP prior to the last GOP demuxed. | 824 // append for a GOP prior to the last GOP demuxed. |
| 825 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected | 825 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected |
| 826 // player stall by replaying cached data since last keyframe in browser player | 826 // player stall by replaying cached data since last keyframe in browser player |
| 827 // rather than issuing browser seek. See http://crbug.com/304234. | 827 // rather than issuing browser seek. See http://crbug.com/304234. |
| 828 return seek_time; | 828 return seek_time; |
| 829 } | 829 } |
| 830 | 830 |
| 831 } // namespace content | 831 } // namespace content |
| OLD | NEW |