Commit Graph

1937 Commits

Author SHA1 Message Date
Yoann Lopes
87abe0bad1 Improve tst_QMediaPlayerBackend::playPauseStop()
Check the state of the media player when trying to play or pause
without a loaded media.

Change-Id: I6685f196457630eb9f4e834426c8e1b9a9eaf8dc
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-08-12 10:33:16 +00:00
Yoann Lopes
7966aca384 Give more time before timeout in some tst_QAudioInput tests
Change-Id: If2336e9c550ef8264d0853be83972a6170a9746b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-08-04 12:24:10 +00:00
David Faure
5b9384336c QPlaylistFileParser: fix QUrl::resolved+QUrl::fromLocalFile misuse
QUrl::resolved can be used to resolve relative paths, but not by
passing them via QUrl::fromLocalFile (8a33077 in qtbase made QUrl
more strict). To resolve both relative and absolute local paths
against a local directory, QUrl::fromUserInput(3 args) does the job.

Change-Id: Ifc01bbd590978f939f9538e70d12f2f3704d7b5d
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-08-04 12:24:01 +00:00
Anatoly Stolbov
d7d31d63db Android camera: use closest viewfinder resolution
For some cameras difference between preview aspect rate and capture
aspect rate is more than 0.01. Therefore it is better to use preview size
with closest aspect rate.

Task-number: QTBUG-50813
Change-Id: I1284c8ec2be1aa160a656e396a52960fa06aaa56
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-27 13:15:53 +00:00
Timur Pocheptsov
7788feea5d AVFMediaAssetWriter - fix race conditions
Apple recommends starting/setting up a session (AVCaptureSession) on a
special queue and in the past we did this on the writer's queue.
Unfortunately, we also can access the same session from a different thread
and this results in race conditions and different weird crashes, for example,
we're calling start/stopRunning from the writer's queue, while the session
is being configured (in between beginConfiguration/commitConfiguration
on the recorder control's thread). So we have to limit access to the session
by the control's thread.

Apple docs say we have to ensure all appendSampleBuffer calls done
_before_ finishWriting. We ensure this by dispatching_sync an
empty block on the writer's queue after store-release of m_state.

We also do the same with video queue to ensure it does not try to
access viewfinder's data after stop/abort executed.

All these changes also make lock/mutex unneeded.

Task-number: QTBUG-54890
Change-Id: I38e86c879b6b62306bdfbeade65405d6ac3be9f3
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-26 13:01:56 +00:00
Jesus Fernandez
ab940d8fe9 Resource leak fixed
CameraBinV4LImageProcessing::setParameter was leaking the resource fd
in some cases in the switch using return instead of break.

Change-Id: Ie56eaf4cf1d1b7531094c321f49a818632985628
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-25 10:27:52 +00:00
BogDan Vatra
6f28963c50 Make sure JNI_OnLoad is not called more than once
Since Android 5.0 Google introduce a nasty bug[1] which calls
JNI_OnLoad more than once.
Basically every time when a library is loaded JNI_OnLoad is
called if found, but it calls *again* JNI_OnLoad of its .so
dependencies!

[1] Workaround https://code.google.com/p/android/issues/detail?id=215069

Change-Id: I81b4a94beedaad299267ac6deab2f9c3a1693a62
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-20 13:04:02 +00:00
Timur Pocheptsov
17674ddc63 AVFMediaAssetWriter - fix atomics use
1. No need in two different atomics (m_stopped/m_aborted) - the single
one 'm_state' with states (Idle/Active/Aborted) should be enough.
2. QAtomicInt::load/store actually have relaxed memory ordering semantics,
(not like std::atomic with sequential ordering as the default one)
which is not always appropriate - replace with loadAquire/storeRelease instead.

Change-Id: I4ce8c9ca7556de3d2c7e369b8a05276b2870460c
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-19 12:56:12 +00:00
Pavel Golikov
278fd530f0 Android: Fix OpenGL texture name leak
This fixes texture name leak when changing media player's source. Texture name
shold be deleted by OpenGLResourcesDeleter class, but when player's source is
changed OpenGLResourcesDeleter's texture name is reassigned with new one
without old name deletion.
This change deletes OpenGLResourcesDeleter's current texture name when new name
is assigned.

Task-number: QTBUG-54340
Change-Id: I22bbd60b4462b0034fd115f0582ea43b9bcaee4b
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-06 14:22:04 +00:00
Yoann Lopes
fd89c0946a DirectShow: correctly clear surface in EVR presenter
The surface was never cleared in the EVR presenter. It could lead to
situations where the presenter would use a destroyed surface.

Change-Id: If2223f09f6f8c20c06345bed40803da10dcf4ae3
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-07-06 07:35:57 +00:00
Christian Strømme
443ed0be09 Android: Fix attach- and detachFromGLContext()
This fixes a regression caused by ba81276398. The change
assumed that the AndroidSurfaceTexture class could cope with changing
textures, but since the callback from the SurfaceTextureListener was
tied to the initial, invalid, texture handle, it would only work as
long as there were only one texture; all textures would register
the callback to the same invalid handle.
This change maps the callback directly to the android texture object,
instead of the texture handle.

Task-number: QTBUG-54340
Change-Id: I39568d0f97fa6b9cb1182efaca568b16a26f0d09
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-05 14:24:40 +00:00
Yoann Lopes
7fb7f278ff DirectShow: fix deadlock in VideoSurfaceFilter
When the DirectShow graph is done being built, there's no need to wake
up any blocking calls on the main thread since setting a source is done
asynchronously anyway.
This could cause synchronous operations (like stopping or changing the
video output) to end prematurely if called while a source was still
being loaded, in turn causing the deadlock.

Task-number: QTBUG-54504
Change-Id: I4f534e637bfca6d3020a3bc28725c8c7042941d5
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
2016-07-05 13:57:19 +00:00
Dan Cape
fa91fc211c QNX: Reset playback position before stopping media
This change ensures that the next media file to be played back will start
playing at position 0. Without this change, it would start playback at the
last position of the previous media file.

In the play() function, when attempting to play a video, we first go into
the loading state which just defers playing until later. Since we set the
state to “Playing”, we now accept events from mm-renderer. It sends us a
position update which ends up being from the previous video. Since we’re
in “Playing” state, we trust this event is right and set our internal
m_position variable to that value. Once the media has loaded, play() is
called again and then we hit the call setPositionInternal() which seeks
the media to our internal m_position (the position we got from mm-renderer).

To resolve this, we now will call setPosition in the stop function that
will cause mm-renderer to seek to 0 just before it stops playback
(as recommended in documentation) so that any events we get from mm-renderer
when we move to the “Playing” state will be related to the current media.

Change-Id: I8ae35e57dd690bbae1fb996c1feb15ee4addab55
Reviewed-by: James McDonnell <jmcdonnell@qnx.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2016-07-04 14:01:51 +00:00
Tuomas Heimonen
efccadf055 tst_qsoundeffect: Update to case testLooping
Be more permissive while checking loops remaining.
Remove file BLACKLIST

Task-number: QTBUG-46689
Change-Id: I15b5fb55ee770a190b2c21dd8cf1fad45665a73c
Reviewed-by: Milla Pohjanheimo <milla.pohjanheimo@qt.io>
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-07-04 13:32:26 +00:00
Maurice Kalinowski
59f20906d9 winrt: Do not assert when missing region of interest
Asserting is too heavy and can cause false positive on devices like the
Lumia 535, where focus is supported, but not setting a focus point.

Later on we check for existence of the control during the
initialization, so it is safe to continue here.

Task-number: QTBUG-54278
Change-Id: Ie68ff754d742888bdd6f4047e07d207707c90c91
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-07-04 13:20:27 +00:00
Ralf Nolden
bc53bb7913 Fix use of -ESTRPIPE where it's not available in errno
NetBSD does not have -ESTRPIPE, so use it only when defined.
http://netbsd.gw.com/cgi-bin/man-cgi?errno+2+NetBSD-6.0
and https://mail-index.netbsd.org/pkgsrc-wip-discuss/2013/10/27/msg002529.html

Change-Id: I92921a16fcae95f58a870aea98ca66f5a5d30a12
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-06-29 09:55:13 +00:00
Yoann Lopes
970128036a PulseAudio: keep device list up to date.
The list of devices was cached on startup and was never updated
when a device was plugged, unplugged or if the default device changed.
We now use the event subscription mechanism in PulseAudio to get
notified of these changes and update the list accordingly.

Change-Id: I5fe1c81494702aa9d38b91009621629dc9606323
Reviewed-by: Karim Pinter <karim.pinter@theqtcompany.com>
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-20 12:41:30 +00:00
Sze Howe Koh
6d48deed48 Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit"
See http://comments.gmane.org/gmane.comp.lib.qt.devel/25771

Change-Id: I9fc15721bf7a26d5da82739a6c83e76e33bb2827
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
2016-06-16 09:15:28 +00:00
Yoann Lopes
32b8310e34 AVFoundation: improve changing the capture device format.
Make sure the device format is always set in the same way.
We don't actually set the format anymore when it's the same as
the current one. We also make sure the frame rate is preserved.

Change-Id: I1c68239bc99d9c3cef920effcf47fc253220c26f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-14 09:55:13 +00:00
Yoann Lopes
af5e0d0485 AVFoundation: re-apply viewfinder settings on mode changes.
Since the active viewfinder resolution can be overridden by the image
and video capture resolutions, we need to re-evaluate the viewfinder
settings whenever the capture mode changes.

Change-Id: Ibdb7a070585cf67ebb2fcfb95ccbdd105f5f41cf
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-13 13:20:57 +00:00
Yoann Lopes
c6a8c2c846 AVFoundation: fix orientation of recorded videos.
Make sure the video is recorded in the same orientation as the device.
That means the top of the video matches the physical side of the device
which is on top when starting recording.
This patch makes sure the behavior is the same as on Android. In a
future version, we should have an API to pick the desired orientation
of the recorded video.

Change-Id: Ia8bbfe621a0e54de3cb6bfe0a520f37e8a932539
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-13 13:20:42 +00:00
Yoann Lopes
f5de141070 AVFoundation: implement QAudioEncoderSettings.
Change-Id: I24d3da1417142bc80bc6b6c1c8124c246afe03db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-09 12:28:24 +00:00
Yoann Lopes
2303d2fef8 AVFoundation: implement QMediaContainerControl.
Change-Id: I5097a0450f5836e48a697249619a1822775f3ad8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-09 12:28:18 +00:00
Liang Qi
e1992d9d1d Merge remote-tracking branch 'origin/5.6.1' into 5.6
Change-Id: I0b4fde2a47b428fd04012a8dbec16fd14797b8dd
2016-06-09 11:15:37 +02:00
Maurice Kalinowski
bff19dbe67 winrt: Fix synchronization problems to render thread
QWinRTAbstractVideoRendererControl::setActive was using
QThread::requestInterrupt previously to indicate to the render thread
that it is supposed to quit.

However, when switching cameras you cannot tell the render thread to
continue rendering. Instead start() is called and then the render thread
recognized the previous interrupt request, resulting in a quit and no
further rendering happening.

Instead we wait for the render thread to complete by using shutdown().

Task-number: QTBUG-53722
Change-Id: Ibee2ed4f64400ca14c788984a73df4be0653ed2b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-06-08 11:09:36 +00:00
Maurice Kalinowski
20299cfc4a winrt: Add logging to QWinRTAbstractVideoRendererControl
Change-Id: I44620b8513fdf20ebc0e093368044133eabdd6b3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-06-08 11:09:31 +00:00
Christian Strømme
b3af8f65fc Android: Fix crash in AndroidCamere::open()
We would attempt to delete the AndroidCameraPrivate object twice if the
native call to open failed. On recent version of Android (~6.0), this
problem is harder to reproduce, as the camera is properly released when
the application goes into the background.

Task-number: QTBUG-53536
Change-Id: I064d276f9025924dfdb071aa52311d2b553c6953
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-06-03 12:43:55 +00:00
Edward Welbourne
b3aa26a0ff QCameraPrivate: NULL-fill fields to be set up by init().
c.f. the constructor already doing the same for provider and the
various fields populated by initControls(), which init() calls.
Should be redundant (all QCamera constructors do invoke d->init() as
soon as they've constructed d), but better safe than sorry.  Calms
Coverity (CID 22319).

Change-Id: Ibf5d13bb1ef17be8e66fa14ed5617b700051c495
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-06-03 12:38:02 +00:00
Yoann Lopes
5473621bde ALSA: improve handling of default device.
- "default" is a valid argument for snd_pcm_open(), let ALSA handle that
case rather than using the first device in the list.
- Don't add "default" in the list of available devices if there is
already one.

Change-Id: Icd41aa6677923a79faf6c90d0627eedd8700b91b
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-03 09:44:48 +00:00
Yoann Lopes
d76d3184b7 Android: flush the current video frame when the video output is reset.
The texture renderer could end up in a situation where a frame could be
scheduled to be rendered after the renderer was reset.

Change-Id: Ie6b6c9d0b5f5851f14aa6eb5f8421196aff8c691
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-03 09:44:10 +00:00
Yoann Lopes
a4656b06eb AVFoundation: correctly set default frame rate on OSX.
On OSX, it's not possible to reset the frame rate to the default value
by passing kCMTimeInvalid, so just set the first value from the
supported frame rates.

Change-Id: I984101c2a95e13053228e56f19b353e716eb2b67
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-03 09:43:48 +00:00
Yoann Lopes
4fa23e08a1 AVFoundation: implement QVideoEncoderSettingsControl.
Task-number: QTBUG-40338
Change-Id: Ic23dabaad94d7b293019460710ae1a097002e227
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-06-03 09:43:10 +00:00
Maurice Kalinowski
c0319d1cfb winrt: focus action has to happen in the xaml thread
Otherwise it will cause asserts and/or crashes.

Change-Id: If8af4202395ae573b280744343dd853346a8c160
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-31 11:53:54 +00:00
Maurice Kalinowski
711efc552d winrt: Fix potential crash when querying for resolutions
c84bdf63e4 introduced a potential crash on
Windows Phone as querying for photo resolutions still might return video
properties. As a result, querying for ImageEncodingProperties will fail
and the function returns no resolution at all causing an assert later
on.

Instead of checking for the stream type passed to
getMediaStreamResolutions we have to check for the property type of the
list itself.

Task-number: QTBUG-53714
Change-Id: I7bfc48ebf1fef4f9165135af604ce6c91a418438
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-31 10:23:00 +00:00
Oswald Buddenhagen
6d5f375644 do not enable example installs explicitly any more
it's done centrally now.

Change-Id: I67cdafc4f2d419b05fc07bc1d1046afba95a3544
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-24 15:55:00 +00:00
Yoann Lopes
52ce26c056 Add changelog for 5.6.1.
Change-Id: I5e4d301ff056b3de2da8f9a5271d36364bfd5dc8
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-05-23 18:31:50 +00:00
Yoann Lopes
d44a327da4 DirectShow: fix playing resource files.
Our custom filter that streams the data into the pipeline was incorrectly
negotiating the sample type with the downstream filter.
This also fixes playback when passing a QIODevice to QMediaPlayer.

Task-number: QTBUG-46899
Change-Id: Iea8b8731d5404c416c8ed0d59cb61958b13b61b0
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-05-20 12:59:25 +00:00
Oswald Buddenhagen
df169ba0aa Bump version
Change-Id: I2b6dc0d097a79d91d0c24cebadac1a891337f576
2016-05-19 13:27:00 +02:00
Liang Qi
9ee131c416 Merge remote-tracking branch 'origin/5.6.1' into 5.6
Change-Id: Iaecbb5c4a33bf0eaffa4f1896bdc09751b1f04c4
2016-05-19 06:36:20 +02:00
Ralf Nolden
1df147d533 Make qtmultimedia 5.6 branch compile without c++11:nullptr usage
5.6 should not require c++11 features, however, nullptr slipped in here.
Replace nullptr with Q_NULLPTR for initialization.

Change-Id: Icf62618657b5bb725bd4c8f924853fa191f6e413
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-17 11:45:23 +00:00
Topi Reinio
3e70c65d2c Doc: Remove repository name from examplesinstallpath
Examples in binary packages now directly match the install path.

Change-Id: Ic272c741ca0bb805dc50ce591ac0ea1d93f07944
Task-number: QTBUG-52953
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
2016-05-12 10:08:30 +00:00
Oswald Buddenhagen
690064468c Merge 5.6 into 5.6.1
Change-Id: Ib4a7640e12319d78ea5ae8f58d79c9fab8d0ea60
2016-05-12 11:18:04 +02:00
Maurice Kalinowski
c84bdf63e4 winrt: Fix crash when initializing certain cameras
Some cameras return video properties when querying for
MediaStreamType_Photo, ie. Surface Book. This caused an assert.

Instead when asking for photo resolutions, only query the available
image resolutions and skip results not of type image.

Change-Id: Ia1886a11f47676d6713eec86f3a80c664871a968
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-11 10:47:57 +00:00
Maurice Kalinowski
15951e672e winrt: Only set focus if supported
Change-Id: Ic6dc2eb6acbd0f5167aa4bad9af08ce8aa5a456b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-10 15:42:13 +00:00
Oswald Buddenhagen
f0e0d5d901 decruft project file
the "created by qt creator" header is not supposed to be checked in.

Change-Id: I6d8c623f41c633babe5923344c915412d3d6bcd4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-10 11:12:21 +00:00
Yoann Lopes
ba81276398 Android: improve texture rendering on API level >= 16.
Android API level 16 added SurfaceTexture::attachToGLContext(). This
allows to create the OpenGL texture when the first video frame is
available, rather than at initialization. This means we can do without
the ugly hack that makes the render thread call us back through some
custom property.
Additionally, it allows to recreate a new OpenGL texture every time
the SurfaceTexture is reset.

Task-number: QTBUG-51911
Change-Id: I17b04524d426c42ef8aa0288b0731597bc9eba62
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2016-05-10 07:37:51 +00:00
Ralf Nolden
37d91ff58d Add FreeBSD define and include for <sys/types.h> where <linux/types.h> is used
Compile fix: FreeBSD uses <sys/types.h> instead of the linux version <linux/types.h>, so this patch
changes the include by Q_OS_FREEBSD define.

Change-Id: Iafe18614ad2360dce9858039b22f9b6c2dd9caaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 16:28:41 +00:00
Yoann Lopes
3c3ea1ca20 Android: detect more error cases when rendering frames to textures.
Don't render the frame if the SurfaceTexture has been released or
if the render size is invalid.

Change-Id: I6b8bf14e023ff54a560b0a9e6027ef9d7d06ab6a
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
2016-05-09 13:11:05 +00:00
Yoann Lopes
80d8466a47 Android: correctly use mutex for texture rendering.
Some sections were not protected by the mutex, even though they should
have been. An example of problem that could happen because of this was
if the SurfaceTexture was reset while the render thread was rendering
that texture.

Change-Id: Ie95860fd4eb722bbac04cccc430cc1a8abf1df4d
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
2016-05-09 13:10:55 +00:00
Friedemann Kleint
6f3e6a78ca Polish the videowidget example.
- Add command line parsing and file argument.
- Port to Qt 5 connection syntax.
- Adapt size to available geometry (for High DPI).

Task-number: QTBUG-53114
Change-Id: I1c1c547ddb14210ef5900f99f4870d6d91b67088
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-05-04 04:28:10 +00:00