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/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "content/renderer/render_view_impl.h" | 32 #include "content/renderer/render_view_impl.h" |
33 #include "gpu/GLES2/gl2extchromium.h" | 33 #include "gpu/GLES2/gl2extchromium.h" |
34 #include "gpu/command_buffer/client/gles2_interface.h" | 34 #include "gpu/command_buffer/client/gles2_interface.h" |
35 #include "gpu/command_buffer/common/constants.h" | 35 #include "gpu/command_buffer/common/constants.h" |
36 #include "gpu/command_buffer/common/mailbox_holder.h" | 36 #include "gpu/command_buffer/common/mailbox_holder.h" |
37 #include "media/base/android/media_codec_util.h" | 37 #include "media/base/android/media_codec_util.h" |
38 #include "media/base/android/media_common_android.h" | 38 #include "media/base/android/media_common_android.h" |
39 #include "media/base/android/media_player_android.h" | 39 #include "media/base/android/media_player_android.h" |
40 #include "media/base/bind_to_current_loop.h" | 40 #include "media/base/bind_to_current_loop.h" |
41 #include "media/base/cdm_context.h" | 41 #include "media/base/cdm_context.h" |
| 42 #include "media/base/media_content_type.h" |
42 #include "media/base/media_keys.h" | 43 #include "media/base/media_keys.h" |
43 #include "media/base/media_log.h" | 44 #include "media/base/media_log.h" |
44 #include "media/base/media_switches.h" | 45 #include "media/base/media_switches.h" |
45 #include "media/base/timestamp_constants.h" | 46 #include "media/base/timestamp_constants.h" |
46 #include "media/base/video_frame.h" | 47 #include "media/base/video_frame.h" |
47 #include "media/blink/webcontentdecryptionmodule_impl.h" | 48 #include "media/blink/webcontentdecryptionmodule_impl.h" |
48 #include "media/blink/webmediaplayer_cast_android.h" | 49 #include "media/blink/webmediaplayer_cast_android.h" |
49 #include "media/blink/webmediaplayer_delegate.h" | 50 #include "media/blink/webmediaplayer_delegate.h" |
50 #include "media/blink/webmediaplayer_util.h" | 51 #include "media/blink/webmediaplayer_util.h" |
51 #include "net/base/mime_util.h" | 52 #include "net/base/mime_util.h" |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 else | 1401 else |
1401 interpolator_.StopInterpolating(); | 1402 interpolator_.StopInterpolating(); |
1402 | 1403 |
1403 if (delegate_) { | 1404 if (delegate_) { |
1404 if (is_playing) { | 1405 if (is_playing) { |
1405 // We must specify either video or audio to the delegate, but neither may | 1406 // We must specify either video or audio to the delegate, but neither may |
1406 // be known at this point -- there are no video only containers, so only | 1407 // be known at this point -- there are no video only containers, so only |
1407 // send audio if we know for sure its audio. The browser side player will | 1408 // send audio if we know for sure its audio. The browser side player will |
1408 // fill in the correct value later for media sessions. | 1409 // fill in the correct value later for media sessions. |
1409 delegate_->DidPlay(delegate_id_, hasVideo(), !hasVideo(), isRemote(), | 1410 delegate_->DidPlay(delegate_id_, hasVideo(), !hasVideo(), isRemote(), |
1410 duration_); | 1411 media::DurationToMediaContentType(duration_)); |
1411 } else { | 1412 } else { |
1412 // Even if OnPlaybackComplete() has not been called yet, Blink may have | 1413 // Even if OnPlaybackComplete() has not been called yet, Blink may have |
1413 // already fired the ended event based on current time relative to | 1414 // already fired the ended event based on current time relative to |
1414 // duration -- so we need to check both possibilities here. | 1415 // duration -- so we need to check both possibilities here. |
1415 delegate_->DidPause(delegate_id_, | 1416 delegate_->DidPause(delegate_id_, |
1416 playback_completed_ || currentTime() >= duration()); | 1417 playback_completed_ || currentTime() >= duration()); |
1417 } | 1418 } |
1418 } | 1419 } |
1419 } | 1420 } |
1420 | 1421 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1704 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1704 switches::kDisableMediaSuspend)) { | 1705 switches::kDisableMediaSuspend)) { |
1705 return false; | 1706 return false; |
1706 } | 1707 } |
1707 | 1708 |
1708 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && | 1709 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && |
1709 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); | 1710 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); |
1710 } | 1711 } |
1711 | 1712 |
1712 } // namespace content | 1713 } // namespace content |
OLD | NEW |