chromium/src/media.git
5 weeks agoMinor code redundancy cleanup. master
hubbe@chromium.org [Fri, 22 Aug 2014 01:08:03 +0000 (01:08 +0000)]
Minor code redundancy cleanup.

The RTCP sender API has reduntant information, getting rid of the redundencies means fewer lines of code.

Review URL: https://codereview.chromium.org/499433002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291288 0039d316-1c4b-4281-b951-d872f2087c98

5 weeks agoReduce demuxer benchmark iterations.
rileya@chromium.org [Fri, 22 Aug 2014 00:59:11 +0000 (00:59 +0000)]
Reduce demuxer benchmark iterations.

BUG=399002

Review URL: https://codereview.chromium.org/495193002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291284 0039d316-1c4b-4281-b951-d872f2087c98

5 weeks agoDelete some dead files
hubbe@chromium.org [Fri, 22 Aug 2014 00:17:49 +0000 (00:17 +0000)]
Delete some dead files

These files aren't used or referenced anywhere, delete them.

Review URL: https://codereview.chromium.org/495203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291262 0039d316-1c4b-4281-b951-d872f2087c98

5 weeks agoMinor cleanup of DecoderStreamTraits.
rileya@chromium.org [Thu, 21 Aug 2014 23:26:28 +0000 (23:26 +0000)]
Minor cleanup of DecoderStreamTraits.

Review URL: https://codereview.chromium.org/491733002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291238 0039d316-1c4b-4281-b951-d872f2087c98

5 weeks agoPass decoded picture size from VDA to client
kcwu@chromium.org [Thu, 21 Aug 2014 21:18:57 +0000 (21:18 +0000)]
Pass decoded picture size from VDA to client

Some of the VDAs, like DXVA and AVDA, don't distinguish
between visible size and coded size. And given GVD is always
been used with container, we should keep using size from
config in GVD.

BUG=390048
TEST=Manually tested: flash player using youtube. html5
player with resolution 1280x720 and 1216x684, h264 and vp8.
apprtc with resolution 640x480 and 636x476. All tests are
performed on both daisy and link.
R=hshi@chromium.org, posciak@chromium.org

Review URL: https://codereview.chromium.org/426873004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291187 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks ago2D Canvas doesn't blend video with the destination buffer.
dongseong.hwang@intel.com [Thu, 21 Aug 2014 15:00:37 +0000 (15:00 +0000)]
2D Canvas doesn't blend video with the destination buffer.

r283338 causes this bug because the fix overwrites the buffer no matter what.
The compositor needs to completely overwrite, while Blink needs to blend. It's
because the compositor reuses the buffer resource and Blink draws the video
frame on the existing GraphicsContext.

BUG=401027

Review URL: https://codereview.chromium.org/441303002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291070 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoMac QTKit Video Capture: Run QTCaptureSession teardown in UI thread, clean up -stopCa...
mcasas@chromium.org [Thu, 21 Aug 2014 08:00:51 +0000 (08:00 +0000)]
Mac QTKit Video Capture: Run QTCaptureSession teardown in UI thread, clean up -stopCapture use.

It can be read in the code:
> QTKit achieves thread safety by posting messages to the
> main thread.  As part of -addOutput:, it posts a message to the main
> thread which in turn posts a notification which will run in a future
> spin after the original method returns.  -removeOutput: can post a
> main-thread message in between while holding a lock which the
> notification handler  will need.  Posting either -addOutput: or
> -removeOutput: to the main thread should fix it, remove is likely
> safer. http://crbug.com/152757

In the same spirit, seems that -removeInput: and -stopRunning are
being called from a background thread causing deadlocks every now
and then. This CL temptatively sends _both_ to be run on UI thread,
hence avoiding the potential deadlock.

-stopCapture is called from VideoCaptureDeviceMac::StopAndDeAllocate()
and then maybe in -setCaptureDevice. Remove the first call
and make sure it's always called inside -setCaptureDevice.

BUG=399792, 285053

Review URL: https://codereview.chromium.org/464363003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@291018 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoImplement ClearKey message format as JSON.
jrummell@chromium.org [Tue, 19 Aug 2014 21:43:38 +0000 (21:43 +0000)]
Implement ClearKey message format as JSON.

The EME-WD specification now describes the format of the license
request provided to the application via the message attribute of
the message event as being JSON formatted. This change updates
the ClearKey implmentation to return the JSON formatted attribute.

For backwards compatibility with the prefixed EME implementation,
the old format (single key id as Uint8Array) is still used for
any prefixed calls.

BUG=358271
TEST=Updated EME layout tests pass

Review URL: https://codereview.chromium.org/427993002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290669 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast: Reject old RTCP packets
hubbe@chromium.org [Tue, 19 Aug 2014 21:29:42 +0000 (21:29 +0000)]
Cast: Reject old RTCP packets

Use the RRTR ntp timestamp to make sure that any packets that is way older than the
newest packet we've seen is rejected. This is needed because we use 8-bit frame IDs,
and by doing this it should become impossible for old packets to confuse the logic
that tries to extend 8-bit frame IDs to 32-bit frame IDs.

Also clean up some logic in congestion_control that was exposed as buggy by the new test.

Review URL: https://codereview.chromium.org/480563004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290667 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoFix some error states in VideoCaptureDeviceWin::AllocateAndStart.
grunell@chromium.org [Tue, 19 Aug 2014 16:11:36 +0000 (16:11 +0000)]
Fix some error states in VideoCaptureDeviceWin::AllocateAndStart.

Review URL: https://codereview.chromium.org/482413002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290580 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast: Deduplicate retransmission packets using audio packets
hclam@chromium.org [Mon, 18 Aug 2014 23:46:19 +0000 (23:46 +0000)]
Cast: Deduplicate retransmission packets using audio packets

Audio packet is sent once every 10 ms. Receiver ACK them as soon as
possible. This makes it a perfect choice to test a round trip from
sender to receiver.

In this change audio stream is used to help deduplicate retransmission
for video. The basic idea is that if sender doesn't observe a full round
trip around the time the packet was last sent then there is a high
chance that the retransmission request is invalid.

Suppose there's an audio packet A sent just before a video packet V. We
reject retransmission of V if A is not acked yet.

Simulation shows no regression with this change when tested with
cast_simulator using IPP traffic model or bad network profile.

BUG=400891

Review URL: https://codereview.chromium.org/452863002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290409 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoFix passing of init_data_type size to CDM_4 and CDM_5.
sandersd@chromium.org [Mon, 18 Aug 2014 23:42:18 +0000 (23:42 +0000)]
Fix passing of init_data_type size to CDM_4 and CDM_5.

BUG=404395

Review URL: https://codereview.chromium.org/482783003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290406 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoRevert 290359 "Remove AudioBuffersState class."
acolwell@chromium.org [Mon, 18 Aug 2014 22:08:24 +0000 (22:08 +0000)]
Revert 290359 "Remove AudioBuffersState class."

Broke ChromeOS bots
http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20ChromeOS/builds/70835/steps/compile/logs/stdio#error1

> Remove AudioBuffersState class.
>
> The AudioBuffersState object doesn't appear to be necessary anymore.
> Most code either completely ignores this information or doesn't actually
> care about the difference between pending_bytes and hardware_delay_bytes.
> Also usually only one of the 2 fields was actually being used at a time.
> This change removes the class and simply uses an int that represent the
> total number of delay bytes.
>
> BUG=125685
>
> Review URL: https://codereview.chromium.org/467833002

TBR=acolwell@chromium.org

Review URL: https://codereview.chromium.org/487543002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290376 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoRemove AudioBuffersState class.
acolwell@chromium.org [Mon, 18 Aug 2014 20:49:14 +0000 (20:49 +0000)]
Remove AudioBuffersState class.

The AudioBuffersState object doesn't appear to be necessary anymore.
Most code either completely ignores this information or doesn't actually
care about the difference between pending_bytes and hardware_delay_bytes.
Also usually only one of the 2 fields was actually being used at a time.
This change removes the class and simply uses an int that represent the
total number of delay bytes.

BUG=125685

Review URL: https://codereview.chromium.org/467833002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290359 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoRewrite of RTCP parser.
hubbe@chromium.org [Mon, 18 Aug 2014 20:04:54 +0000 (20:04 +0000)]
Rewrite of RTCP parser.

Clears out of lot of cruft and data copying.
Makes the parser easier to read.
Parser uses BigEndianReader for everything, which makes security easier to verify.
Removes ~1000 lines of code.

BUG=396207

Review URL: https://codereview.chromium.org/477593003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290348 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoMac Video Capture: Change an ErrorMessage to LogMessage
mcasas@chromium.org [Mon, 18 Aug 2014 13:45:21 +0000 (13:45 +0000)]
Mac Video Capture: Change an ErrorMessage to LogMessage

A situation in which we're trying to stop capturing from a device
that has never been initialised properly ends up in
-sendErrorMessage:, but that in turn will trigger VideoCaptureController
-> VideoCaptureHost -> MediaStreamManager, that would try to tear
down the whole capture infrastructure, and that would end up in
the same point that caused the -sendErrorMessage.

In this case, Log instead of sending an Error.

Review URL: https://codereview.chromium.org/480023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290250 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoFix the unnecessary sleep when no back to back OnData call.
xians@chromium.org [Mon, 18 Aug 2014 12:43:02 +0000 (12:43 +0000)]
Fix the unnecessary sleep when no back to back OnData call.

The sleep is required by Pepper Flash input to avoid back to back OnData() call, which will override the previous buffer if it happens.

This CL is a follow up to https://codereview.chromium.org/465313002/

BUG=403675
TEST=bots.

Review URL: https://codereview.chromium.org/486603002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290243 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoFix windows compilation warning in es_parser_adts.
damienv@chromium.org [Mon, 18 Aug 2014 09:53:15 +0000 (09:53 +0000)]
Fix windows compilation warning in es_parser_adts.

Export the mpeg2 ts EsParser base class
so that NON_EXPORTED_BASE is not needed
in EsParserH264 and EsParserAdts.

BUG=None
NOTRY=True

Review URL: https://codereview.chromium.org/483513002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290231 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast: cast_simulator to use the same settings at the extension
hclam@chromium.org [Sat, 16 Aug 2014 08:25:07 +0000 (08:25 +0000)]
Cast: cast_simulator to use the same settings at the extension

Set the cast simulator same default values as the extensions.
This means 400 ms target latency and 2 - 2.5mbits/s bitrate.

TBR=miu

Review URL: https://codereview.chromium.org/473373002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290134 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast: Increase max outstanding frames to 120
hclam@chromium.org [Sat, 16 Aug 2014 08:07:05 +0000 (08:07 +0000)]
Cast: Increase max outstanding frames to 120

Max outstanding frame used to be 60 to work around an issue with 8-bits
integer wrap around for frame IDs. Now the logic for handling wrap
around us less buggy we can increase the limit to 120 frames.

TBR=hubbe

Review URL: https://codereview.chromium.org/476303004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290126 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast: Move retransmission to the transport
hclam@chromium.org [Sat, 16 Aug 2014 05:42:22 +0000 (05:42 +0000)]
Cast: Move retransmission to the transport

This change is to move the logic of retransmission from AudioSender/
VideoSender to CastTransportSender.

With this change AudioSender and VideoSender will not handle packets any
more. They will simply see frames. Retransmission is now handled by
CastTransportSender.

Added two more public methods for CastTransportSender:
* CancelSendingFrames
  Cancel sending certain frames.
* SendFrameForKickstart
  Sends the last packet of a frame to kick start the session.

cast_simulator shows no regression.
BUG=393042

Review URL: https://codereview.chromium.org/445933002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290094 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoSmarter algorithm for extending 8-bit frame IDs to 32-bit frame IDs.
hubbe@chromium.org [Fri, 15 Aug 2014 21:54:17 +0000 (21:54 +0000)]
Smarter algorithm for extending 8-bit frame IDs to 32-bit frame IDs.

The previous algorithm was limited to jumps of ~64, the new algorithm
can handle jumps of ~127.

Review URL: https://codereview.chromium.org/458313003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@290023 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoChanges to media.gyp for Chromoting iOS client
dcaiafa@chromium.org [Fri, 15 Aug 2014 19:25:43 +0000 (19:25 +0000)]
Changes to media.gyp for Chromoting iOS client

This makes the following changes to media.gyp to make it compile for iOS (for
the Chromoting iOS client):

- Don't use ffmpeg or libvpx in media (just like Android)
- Do use libyuv
- Add yasm flag to decorate functions correctly for iOS (just like in the Mac)

BUG=134226

Review URL: https://codereview.chromium.org/474693002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289973 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoMpeg2 TS - Fail when no valid timestamp in the ADTS parser.
damienv@chromium.org [Fri, 15 Aug 2014 18:25:57 +0000 (18:25 +0000)]
Mpeg2 TS - Fail when no valid timestamp in the ADTS parser.

BUG=None

Review URL: https://codereview.chromium.org/399433003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289944 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoBail out with error instead of dvlog if fail to GetNumberOfCapabilities in Windows...
grunell@chromium.org [Fri, 15 Aug 2014 16:40:12 +0000 (16:40 +0000)]
Bail out with error instead of dvlog if fail to GetNumberOfCapabilities in Windows video capture start.

Review URL: https://codereview.chromium.org/477653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289917 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoCast streaming logging: Log additional stats for the GetStats() API.
imcheng@chromium.org [Fri, 15 Aug 2014 15:51:30 +0000 (15:51 +0000)]
Cast streaming logging: Log additional stats for the GetStats() API.

* Total frames captured
* Total frames dropped
* Total frames late
* Total packet count
* Total packet retransmission
* Total packet retransmission rejected

BUG=403921

Review URL: https://codereview.chromium.org/472203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289879 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoSupport persistent sessions with CDM5/6.
jrummell@chromium.org [Fri, 15 Aug 2014 05:05:33 +0000 (05:05 +0000)]
Support persistent sessions with CDM5/6.

The prefixed API adds some known data to the front of the init_data
parameter to specify persistent sessions. CDM5/6 includes a parameter
to CreateSession() that specifies if the session is persistent or not.
Use the prefix to determine if a session is persistent (and remove it
from the init_data before passing it to the CDM).

BUG=403527
TEST=encrypted-media layout tests and browser_tests for encrypted media pass

Review URL: https://codereview.chromium.org/471763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289794 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoVideoRendererImpl: Delay report of BUFFERING_HAVE_NOTHING.
acolwell@chromium.org [Fri, 15 Aug 2014 04:43:52 +0000 (04:43 +0000)]
VideoRendererImpl: Delay report of BUFFERING_HAVE_NOTHING.

Currently VideoRendererImpl triggers the pipeline to underflow immediately after
it runs out of frame. This is not desired because relatively small video
decoding glitch would cause audio to stutter as well, which is more noticeable
than some dropped video frames. With this CL, VRI only declares
BUFFERING_HAVE_NOTHING after it has run out of buffers and have not painted any
frame for certain amount of time (e.g. 3s in media time). In other words, video
can still trigger pipeline underflow but won't do this until really necessary.

BUG=144683
TEST=Tested by making video decoder slower. See
https://codereview.chromium.org/464113003/

Review URL: https://codereview.chromium.org/475863002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289786 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoUsing PROFILE_ANY for vp8 and vp9
amogh.bihani@samsung.com [Fri, 15 Aug 2014 03:29:51 +0000 (03:29 +0000)]
Using PROFILE_ANY for vp8 and vp9

VP8 and VP9 do not take profile into account. Using PROFILE_MAIN is confusing.
This patch uses PROFILE_ANY for these codecs.

TBR=noelallen@chromium.org

BUG=361676

Review URL: https://codereview.chromium.org/418193003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289765 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoUpdate ClearKey to support CDM_6
jrummell@chromium.org [Fri, 15 Aug 2014 03:05:54 +0000 (03:05 +0000)]
Update ClearKey to support CDM_6

This change adds support for GetUsableKeyIds() and RemoveSession(),
and renames ReleaseSession() to CloseSession(). There are also
changes due to the Ready event no longer being generated by the CDM
interface.

BUG=358271,351139
TEST=encrypted-media layout tests and browser_tests for encrypted media pass

Review URL: https://codereview.chromium.org/448893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289755 0039d316-1c4b-4281-b951-d872f2087c98

6 weeks agoAdd UMA stats for silence AudioInputController.
grunell@chromium.org [Thu, 14 Aug 2014 20:20:30 +0000 (20:20 +0000)]
Add UMA stats for silence AudioInputController.

4 cases of silence during a session: no measurement, no silence, only silence and partial silence.

NOTRY=true

BUG=399835

Review URL: https://codereview.chromium.org/462813004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289688 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoConvert between |init_data_type| and content type.
sandersd@chromium.org [Thu, 14 Aug 2014 16:01:37 +0000 (16:01 +0000)]
Convert between |init_data_type| and content type.

This allows both to be used while Blink and the tests are transitioned.

BUG=385874

Review URL: https://codereview.chromium.org/472493003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289605 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agogn win: Don't add linux-style cflags
scottmg@chromium.org [Thu, 14 Aug 2014 14:36:21 +0000 (14:36 +0000)]
gn win: Don't add linux-style cflags

R=dalecurtis@chromium.org,brettw@chromium.org
BUG=354261

Review URL: https://codereview.chromium.org/471753002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289564 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMac QTKit Video Capture: Force BlackMagic cameras to be opened in HD
mcasas@chromium.org [Thu, 14 Aug 2014 14:07:12 +0000 (14:07 +0000)]
Mac QTKit Video Capture: Force BlackMagic cameras to be opened in HD

This is a refry of http://crrev.com/410363002, original description:
>Force BlackMagic cameras to be opened in HD
>
>The Blackmagic driver causes a crash in QTKit when opened in VGA
>when NTSC/PAL 10-bit is selected.  QTKit does not allow us to query a
>device's supported resolution, so this change adds BlackMagic to another
>blacklist so that it is always opened in HD.

In this continuation CL, Blacklisted QTKit devices are found during
enumeration and flagged, so
a) a special capability list is cooked for them, only including HD,
b) they are not reconfigured on opening/capturing.

BUG=396812, 347371
COLLABORATOR= vrk@chromium.org
R=tommi@chromium.org, vrk@chromium.org

Review URL: https://codereview.chromium.org/468833002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289552 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoAdd UMA reporting to CdmPromise.
sandersd@chromium.org [Thu, 14 Aug 2014 03:52:31 +0000 (03:52 +0000)]
Add UMA reporting to CdmPromise.

This allows all CdmPromise objects to report their result (success or
exception) if given the name of a histogram at construction.

As an example, a UMA for the unprefixed NewSession method is included.

BUG=351501

Review URL: https://codereview.chromium.org/452643002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289453 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoRevert 289312 "Move StringToUpperASCII and LowerCaseEqualsASCII ..."
brettw@chromium.org [Wed, 13 Aug 2014 16:48:41 +0000 (16:48 +0000)]
Revert 289312 "Move StringToUpperASCII and LowerCaseEqualsASCII ..."

> Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace
>
> Convert LowerCaseEqualsASCII to take StringPiece. In the current patch this is
> generally a NOP but will allow me to delete the other 4 variants in a followup
> (wanted to do that separately since that will require more review, since
> callsites will be changed in nontrivial ways).
>
> In some cases, LowerCaseEqualsASCII is called with a WebString, which no
> longer is implicitly converted. I added base::string16(...) around such
> calls to force the right conversion. It happened in these files:
>   window_container_type.cc
>   savable_resources.cc
>   render_view_impl.cc
>   blink_ax_tree_source.cc
>   password_form_conversion_utils.cc
>   translate_helper.cc
>   chrome_render_view_observer.cc
>   dom_serializer_browsertest.cc
>
> R=jamesr@chromium.org
>
> Review URL: https://codereview.chromium.org/448143008

TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/474483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289320 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMove StringToUpperASCII and LowerCaseEqualsASCII to the base namespace
brettw@chromium.org [Wed, 13 Aug 2014 16:23:25 +0000 (16:23 +0000)]
Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace

Convert LowerCaseEqualsASCII to take StringPiece. In the current patch this is
generally a NOP but will allow me to delete the other 4 variants in a followup
(wanted to do that separately since that will require more review, since
callsites will be changed in nontrivial ways).

In some cases, LowerCaseEqualsASCII is called with a WebString, which no
longer is implicitly converted. I added base::string16(...) around such
calls to force the right conversion. It happened in these files:
  window_container_type.cc
  savable_resources.cc
  render_view_impl.cc
  blink_ax_tree_source.cc
  password_form_conversion_utils.cc
  translate_helper.cc
  chrome_render_view_observer.cc
  dom_serializer_browsertest.cc

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/448143008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289312 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoAdd UMA stats for open audio input device failure.
grunell@chromium.org [Wed, 13 Aug 2014 14:30:10 +0000 (14:30 +0000)]
Add UMA stats for open audio input device failure.

* Change UMA stats for capture startup to an enum. It retains the meanings of the current (bool) values 0 and 1.
* Add values for fail to create and open stream (device).
* Remove |enable_nodata_timer| which doesn't have any use.

BUG=399835

Review URL: https://codereview.chromium.org/460993002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289288 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoReduces DVLOG overhead in PulseAudioInputStream for Linux.
henrika@chromium.org [Wed, 13 Aug 2014 12:50:07 +0000 (12:50 +0000)]
Reduces DVLOG overhead in PulseAudioInputStream for Linux.

The existing DVLOG creates a huge amount of log output when using a */media/*=1 filter.

TBR=xians1
BUG=none

Review URL: https://codereview.chromium.org/465313002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289274 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoCast: Fix use after free in a testing tool
hclam@chromium.org [Wed, 13 Aug 2014 09:15:32 +0000 (09:15 +0000)]
Cast: Fix use after free in a testing tool

cast_simulator should call .Pass() to pass the PacketPipe for
simulation.

TBR=miu

Review URL: https://codereview.chromium.org/463373003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289226 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoAllow setContentDecryptionModule() to get called when setting is done.
jrummell@chromium.org [Wed, 13 Aug 2014 04:01:23 +0000 (04:01 +0000)]
Allow setContentDecryptionModule() to get called when setting is done.

Decoders can register to get notified when a Decryptor is set.
setContentDecryptionModule() provides a new Decryptor to
WebMediaPlayer. Since the decoders run on the media thread, it may
take some time for the old Decryptor to get detached and a new one
connected. Adding a callback to be used so that
setContentDecryptionModule() knows when the Decoders are done with
the notification. The additional callback is optional. This will be
used to resolve the setMediaKeys() promise on the blink side.

BUG=358271
TEST=media unittests and EME layout tests pass

Review URL: https://codereview.chromium.org/416333011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289197 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMac Video Capture: expose --enable-avfoundation as tristate in chrome://flags
mcasas@chromium.org [Tue, 12 Aug 2014 20:00:56 +0000 (20:00 +0000)]
Mac Video Capture: expose --enable-avfoundation as tristate in chrome://flags

Currently chrome://flags only exposes #enable-avfoundation as an enable
link. This CL exposes instead a tristate compose of Default/Enable/Disable.

BUG=356106, 396764

Review URL: https://codereview.chromium.org/460113006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289053 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoIntroduce DecodeTimestamp class to make it easier to distiguish presentation and...
acolwell@chromium.org [Tue, 12 Aug 2014 18:29:49 +0000 (18:29 +0000)]
Introduce DecodeTimestamp class to make it easier to distiguish presentation and decode timestamps.

DecodeTimestamp is a thin wrapper around base::TimeDelta that makes it
possible to easily differentiate decode timestamps from presentation
timestamps. Using a separate type also forces conversions between these
two domains to be done explicitly through conversion functions. This
change introduces the class and updates all the variables that contain
decode timestamps. It also puts in place the necessary conversion calls
for converting between timestamp types. There should be no functional
change as a result of this patch. This class is mainly to allow the
compiler to highlight where conversions between timestamp types occur.

Having DecodeTimestamp will make it much easier to rework
SourceBufferStream so that it properly handles B-frame content and
reports buffered ranges in terms of presentation time instead of
decode time.

BUG=398130
TEST=All existing tests still pass.

Review URL: https://codereview.chromium.org/447963003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289031 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoCast: add UMA for video encode accelerator initialization result.
posciak@chromium.org [Tue, 12 Aug 2014 18:25:26 +0000 (18:25 +0000)]
Cast: add UMA for video encode accelerator initialization result.

Add Cast.Sender.VideoEncodeAcceleratorInitializeSuccess indicating
whether we were successful in initializing an external video encode
accelerator for cast sender.

BUG=397038
TEST=Cast, check histograms

Review URL: https://codereview.chromium.org/458693004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289029 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMediaStreamTrack.getSources list is now updated when input devices is disabled on...
henrika@chromium.org [Tue, 12 Aug 2014 18:03:19 +0000 (18:03 +0000)]
MediaStreamTrack.getSources list is now updated when input devices is disabled on Windows.

BUG=395733
TEST=https://simpl.info/getusermedia/sources/

Review URL: https://codereview.chromium.org/459363003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289019 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMac Video Capture: correct to float the erroneous handling of frame rate as int.
mcasas@chromium.org [Tue, 12 Aug 2014 17:07:59 +0000 (17:07 +0000)]
Mac Video Capture: correct to float the erroneous handling of frame rate as int.

This is a fix for a latent bug.

Tentatively, this is also causing http://crbug.com/394315.

BUG=380463, 394315

Review URL: https://codereview.chromium.org/464853002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289008 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoGN: Make content_shell and webkit_unit_tests work in component build
jamesr@chromium.org [Tue, 12 Aug 2014 17:07:12 +0000 (17:07 +0000)]
GN: Make content_shell and webkit_unit_tests work in component build

Except for webrtc, this produces content_shell and webkit_unit_tests
binaries that link and run successfully on linux.

R=brettw@chromium.org

Review URL: https://codereview.chromium.org/462983002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@289007 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoRestores AudioAndroidOutputTest.StartOutputStreamCallbacksNonDefaultParameters.
henrika@chromium.org [Tue, 12 Aug 2014 11:51:17 +0000 (11:51 +0000)]
Restores AudioAndroidOutputTest.StartOutputStreamCallbacksNonDefaultParameters.

BUG=374038
TEST=local tests on Nexus 7. Nexus 5 and Galaxy Note 3
R=tommi@chromium.org

Review URL: https://codereview.chromium.org/458183002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288936 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoRestrict max outstanding frames to 60
hubbe@chromium.org [Tue, 12 Aug 2014 03:36:58 +0000 (03:36 +0000)]
Restrict max outstanding frames to 60

In theory, 127 outstanding frames should be ok, but due to a bug in our code,
we can run into problem if we see a jump in frames larger than 64. This
CL will work around that problem by restricting the max outstanding frames to
60. In a later CL, we'll change this to a larger number once the actual bug
has been found and fixed.

BUG=402693
NOTRY=true
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/455053003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288904 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMake DSCP work for UDP sockets on windows
hubbe@chromium.org [Tue, 12 Aug 2014 03:07:08 +0000 (03:07 +0000)]
Make DSCP work for UDP sockets on windows

This uses the QWAVE library to set DSCP flags on outgoing UDP packets.
QWAVE is supported on Windows Vista and later, which is why we need to
use LoadLibrary to access it.

BUG=277022

Review URL: https://codereview.chromium.org/448863002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288886 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMake audio buffer 2x video buffer instead of 3x.
hubbe@chromium.org [Tue, 12 Aug 2014 01:54:33 +0000 (01:54 +0000)]
Make audio buffer 2x video buffer instead of 3x.

Review URL: https://codereview.chromium.org/460113002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288871 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoSplit out media/base and media/android into GN targets.
dalecurtis@chromium.org [Mon, 11 Aug 2014 23:51:04 +0000 (23:51 +0000)]
Split out media/base and media/android into GN targets.

Takes over https://codereview.chromium.org/381293002/

BUG=none
TEST=media_unittests builds and has same number of targets.

Review URL: https://codereview.chromium.org/433193003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288832 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoCast: Fix ExternalVideoEncoder early destruction scenario.
posciak@chromium.org [Mon, 11 Aug 2014 19:33:38 +0000 (19:33 +0000)]
Cast: Fix ExternalVideoEncoder early destruction scenario.

It's possible for ExternalVideoEncoder to get destroyed before it can
receive OnCreateVideoEncodeAccelerator callback. In that case the we
will crash, attempting to post LocalVideoEncodeAcceleratorClient::Destroy
to a still-NULL encoder_task_runner_. VEA::Destroy would still be
called, since it's called from the specialized destructor of VEA and
scopers would take care of this, but it may then be executed on
a wrong thread (i.e. not encoder_task_runner_).

Fix this by moving the VEA creation flow to LocalVideoEncodeAcceleratorClient
instead, which will outlive ExternalVideoEncoder even if it gets destroyed
before VEA finishes being created and properly destroy it in that case.

This also simplifies the creation flow by reducing argument passing between
classes.

Also add a unittest for this scenario.

BUG=
TEST=Cast browser_tests, cast_unittests, cast on CrOS

Review URL: https://codereview.chromium.org/447193003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288763 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agotap_proxy - bad network simulation for linux
hubbe@chromium.org [Mon, 11 Aug 2014 17:34:12 +0000 (17:34 +0000)]
tap_proxy - bad network simulation for linux

Three files:
shadow.sh - setup a tap network which shadows eth1
tap_proxy - forward traffic between two tap devices with delay/drops
netload.py - create TCP network traffic

See shadow.sh for more detailed information.

Review URL: https://codereview.chromium.org/415403009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288737 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoRoll FFmpeg for M38
wolenetz@chromium.org [Sat, 9 Aug 2014 10:40:09 +0000 (10:40 +0000)]
Roll FFmpeg for M38

Syncs to head as of afd62b3f184569492230e7f34ad55581c6b2d2c3 modulo
changes and reverts in Chromium FFmpeg merge-m38 branch that mitigate
regressions.
The roll includes the following changes due to API changes and tooling
results:
* Increases DecoderBuffer::kPaddingSize due to
  FF_INPUT_BUFFER_PADDING_SIZE increase.
* Removes valgrind memcheck suppression bug_399924 for a leak this roll
  no longer hits.
* Uses avcodec_free_context() to close and free codec contexts.

R=dalecurtis@chromium.org
TBR=earthdok@chromium.org
BUG=399924

Review URL: https://codereview.chromium.org/454723002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288559 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoAdded rotation operation to Paint for Canvas/WebGL copying. This
suderman@chromium.org [Sat, 9 Aug 2014 05:52:38 +0000 (05:52 +0000)]
Added rotation operation to Paint for Canvas/WebGL copying. This
corrects for wrong video orientation.

BUG=47554

Review URL: https://codereview.chromium.org/402133005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288518 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoMake media::AudioClock track frames written to compute time.
scherkus@chromium.org [Fri, 8 Aug 2014 21:56:37 +0000 (21:56 +0000)]
Make media::AudioClock track frames written to compute time.

Instead of using AudioRendererAlgorithm's timestamp as the ending
timestamp and counting "backwards", count "forwards" from a starting
timestamp to compute the current media time. Doing so produces more
accurate time calculations during periods where the playback rate
is changing.

last_endpoint_timestamp() is replaced by a new method that computes
the amount of contiguous media data buffered by audio hardware. Using
this value gives a more accurate maximum time value to use when doing
linear interpolation.

BUG=367343,370634

Review URL: https://codereview.chromium.org/436053002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288445 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks ago[Checkstyle] Update static variable and constant names to match style guides.
aurimas@chromium.org [Fri, 8 Aug 2014 19:27:00 +0000 (19:27 +0000)]
[Checkstyle] Update static variable and constant names to match style guides.

- Static field names start with s.
- static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.
http://source.android.com/source/code-style.html#follow-field-naming-conventions

BUG=318404
TBR=qinmin

Review URL: https://codereview.chromium.org/455523002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288416 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoAdd support for CDM_6.
jrummell@chromium.org [Fri, 8 Aug 2014 10:07:14 +0000 (10:07 +0000)]
Add support for CDM_6.

Changes for CDM_6:
- ReleaseSession() becomes CloseSession()
- add RemoveSession()
- add GetUsableKeyIds()
- simulate UsableKeysChanged event for older CDMs

BUG=358271,351139
TEST=encrypted-media layout tests and browser_tests for encrypted media pass

Review URL: https://codereview.chromium.org/446693004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288295 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoDon't crash when splices are in the past due to bad media.
dalecurtis@chromium.org [Fri, 8 Aug 2014 09:43:12 +0000 (09:43 +0000)]
Don't crash when splices are in the past due to bad media.

Bad media may result in splice frames way in the past.  We need
to avoid crashing in this case.  See the bug for more details.

BUG=400442
TEST=new media test.

Review URL: https://codereview.chromium.org/440803002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288284 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoFix for cross-origin video check for webgl
qinmin@chromium.org [Fri, 8 Aug 2014 08:00:50 +0000 (08:00 +0000)]
Fix for cross-origin video check for webgl

We landed a hack earlier to treat all video urls as cross-origin for an security issue.
That fix, however, breaks all webgl tests that has video in it.
This CL brings a proper fix to the original issue.
It uses a new API available in the android L preview System image.
For systems below K, the security impact is much less serious than the issue it caused.
As a result, we are reenabling video for webgl for systems <=K.
And the security issues on these systems should be resolved when devices upgrade.

BUG=358198

Review URL: https://codereview.chromium.org/408873004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288242 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoIntegrated video rotation piping into video layer {impl} and
suderman@chromium.org [Fri, 8 Aug 2014 01:24:47 +0000 (01:24 +0000)]
Integrated video rotation piping into video layer {impl} and
included the transform for fixing the video orientation.

BUG=47554

Review URL: https://codereview.chromium.org/388643002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288194 0039d316-1c4b-4281-b951-d872f2087c98

7 weeks agoPipeline: Invalidate weak pointers before returning stop callback.
xhwang@chromium.org [Fri, 8 Aug 2014 00:51:25 +0000 (00:51 +0000)]
Pipeline: Invalidate weak pointers before returning stop callback.

This is a follow up CL of r287687, which missed the corner case that an error
happened before Stop().

This CL also updated the PipelineTest so that we explicitly check that all weak
pointers must have been invalidated before the stop callback returns. With this
check PipelineTeardownTest.Error_* tests will cover this corner case.

BUG=399417
TEST=Updated unit test.

Review URL: https://codereview.chromium.org/444333007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@288181 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoFix MediaDrmBridgeTest.IsKeySystemSupported_Widevine test.
xhwang@chromium.org [Wed, 6 Aug 2014 20:06:27 +0000 (20:06 +0000)]
Fix MediaDrmBridgeTest.IsKeySystemSupported_Widevine test.

BUG=401092

Review URL: https://codereview.chromium.org/449523003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287840 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoPlumb frame rate configuration into Cast Streaming API.
miu@chromium.org [Wed, 6 Aug 2014 18:51:26 +0000 (18:51 +0000)]
Plumb frame rate configuration into Cast Streaming API.

BUG=400930

Review URL: https://codereview.chromium.org/442863005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287814 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoHandle platforms with no bluetooth in AudioManagerAndroid.
benm@chromium.org [Wed, 6 Aug 2014 18:46:18 +0000 (18:46 +0000)]
Handle platforms with no bluetooth in AudioManagerAndroid.

AudioManagerAndroid will NPE on hardware platforms that don't
have bluetooth.

BUG=401039

Review URL: https://codereview.chromium.org/449463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287813 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoCast: Not leak in cast_unittests
hclam@chromium.org [Wed, 6 Aug 2014 17:15:13 +0000 (17:15 +0000)]
Cast: Not leak in cast_unittests

cast_unittests was leaking because SimpleTestTickClock was not owned by
anyone. This change makes it owned by RtcpReceiverTest.

TBR=miu
BUG=400728, 393042

Review URL: https://codereview.chromium.org/442273002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287792 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agocopy codec_delay & seek_preroll in decrypting_demuxer to fix bug 400095
tbutter@gmail.com [Wed, 6 Aug 2014 11:51:15 +0000 (11:51 +0000)]
copy codec_delay & seek_preroll in decrypting_demuxer to fix bug 400095

BUG=400095

Review URL: https://codereview.chromium.org/437203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287760 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agochange opus sample format to kSampleFormatF32
tbutter@gmail.com [Wed, 6 Aug 2014 09:22:10 +0000 (09:22 +0000)]
change opus sample format to kSampleFormatF32

Playing a WebM File with opus audio via MediaSource currently uses
kSampleFormatS16. In a video src it uses kSampleFormatF32.
S16 does not work (just plays noise).

BUG=400247
R=vigneshv@chromium.org

Review URL: https://codereview.chromium.org/437813005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287743 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoCast: cast_simulator to print more info
hclam@chromium.org [Wed, 6 Aug 2014 07:55:59 +0000 (07:55 +0000)]
Cast: cast_simulator to print more info

Print more information in cast_simulator:
1. Total video frames.
2. Dropped video frames.
3. Late video frames.
4. Avg. target bitrate.
5. Avg. encoded bitrate.

Review URL: https://codereview.chromium.org/433363002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287733 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoCast: Use fixed bitrate and set it once for hardware encoder
hclam@chromium.org [Wed, 6 Aug 2014 07:06:01 +0000 (07:06 +0000)]
Cast: Use fixed bitrate and set it once for hardware encoder

Some hardware encoder cannot handle bitrate changing too quickly. The
solution is to have a fixed bitrate and only set it once.

BUG=392086

Review URL: https://codereview.chromium.org/439863003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287721 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoPipeline: Use WeakPtr for DemuxerHost Calls and Tasks.
xhwang@chromium.org [Wed, 6 Aug 2014 05:46:06 +0000 (05:46 +0000)]
Pipeline: Use WeakPtr for DemuxerHost Calls and Tasks.

There is a chance that the Demuxer calls host_->OnDemuxerError() right
before Stop() is called. The Pipeline always posts a ErrorChangedTask() for
OnDemuxerError() with base::Retained(this).

After the Demuxer fires the stop callback, the Pipeline could be destroyed
immediately. So If the media thread hasn't been destroyed we could end up with
running ErrorChangedTask() on null pipeline which causes a crash.

This CL uses a weak pointer for DemuxerHost calls so that no task will run
after the pipeline is destroyed.

BUG=397656, 399417, 365141
TEST=Updated unit tests to cover this case.
R=scherkus@chromium.org

Review URL: https://codereview.chromium.org/423073012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287687 0039d316-1c4b-4281-b951-d872f2087c98

8 weeks agoFix new[]/delete mismatch in AudioBusPerfTest.
scherkus@chromium.org [Tue, 5 Aug 2014 01:09:03 +0000 (01:09 +0000)]
Fix new[]/delete mismatch in AudioBusPerfTest.

Discoved while running media_perftests on a local debug build.

Review URL: https://codereview.chromium.org/441673003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287429 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoFix flaky cast_unittests where threads were being joined incorrectly.
miu@chromium.org [Sat, 2 Aug 2014 11:19:43 +0000 (11:19 +0000)]
Fix flaky cast_unittests where threads were being joined incorrectly.

Root cause of the flakiness is that the StandaloneCastEnvironment, as a
ref-counted object, was being destroyed on a thread other than the one
that created it.  At destruction, it attempted to join on the threads it
owns, but these threads must be joined with the thread that they were
spawned from.

BUG=396480

Review URL: https://codereview.chromium.org/436673004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287194 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoPurge net/ and ui/base from media_unittest DEPS.
dalecurtis@chromium.org [Sat, 2 Aug 2014 08:07:44 +0000 (08:07 +0000)]
Purge net/ and ui/base from media_unittest DEPS.

Saves us over 1200 files during compilation!!  Also
cleans up media_perftests for a smaller savings.

BUG=302505
TEST=media_unittests is at ~3000 files now.

Review URL: https://codereview.chromium.org/438963005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287189 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoAdd support for partial append window end trimming.
dalecurtis@chromium.org [Sat, 2 Aug 2014 07:35:55 +0000 (07:35 +0000)]
Add support for partial append window end trimming.

Facilitates gapless playback across mp3 and aac.  Relying on splice
frames and crossfading doesn't work in cases where the prior segment
signal diverges to null-padding values too quickly relative to the
newly appended segment.

BUG=395899
TEST=new unittests. llama-demo works.

Review URL: https://codereview.chromium.org/414603002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287174 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoCast: Remove unused RTCP messages
hclam@chromium.org [Sat, 2 Aug 2014 01:21:47 +0000 (01:21 +0000)]
Cast: Remove unused RTCP messages

Removing the following unused RTCP messages:
* PLI
* NACK
* RPSI
* REMB
* BYE
* SDES

Deleted about 1200 lines of code. Tested with cast_unittests
and simulation shows no difference. Casting to a proper
receiver works as well.

BUG=393042

Review URL: https://codereview.chromium.org/427733002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287142 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoRevert "Revert 285479 "Make DataSource::Stop() synchronous.""
xhwang@chromium.org [Sat, 2 Aug 2014 00:41:58 +0000 (00:41 +0000)]
Revert "Revert 285479 "Make DataSource::Stop() synchronous.""

This reverts commit aca48d3efdf5ba8a891d6f139fd8ba8db8d69fc2.

The original CL didn't cause issue 397656. It's caused by previous CLs and is
fixed by r286787. This CL simply reland the original CL.

TBR=gbillock@chromium.org
BUG=349211, 397656
TEST=Existing tests pass.

Review URL: https://codereview.chromium.org/435023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287136 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoRewrite negative ogg timestamps and ignore kNoTimestamp().
dalecurtis@google.com [Fri, 1 Aug 2014 17:37:26 +0000 (17:37 +0000)]
Rewrite negative ogg timestamps and ignore kNoTimestamp().

Sadly both of these issues are still occurring, so revert strict checks.

BUG=384532,396864
TEST=media_unittests
R=acolwell@chromium.org

Review URL: https://codereview.chromium.org/426393002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@287037 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoDelay back to back PulseAudio write request callbacks.
dalecurtis@chromium.org [Fri, 1 Aug 2014 07:33:01 +0000 (07:33 +0000)]
Delay back to back PulseAudio write request callbacks.

Avoids trampling shared memory when Pulse issues back to back
callbacks for whatever reason.  Locally I hit the sleep many
times per stream without any noticeable glitching.

I've also adjusted the |minreq| value to reduce the number of
callbacks, in practice this shouldn't hurt buffering since we
always write out a full buffer regardless of the amount requested.

BUG=366433
TEST=pulse output is glitch free on WebAudio, HTML5, WebRTC.

Review URL: https://codereview.chromium.org/414313005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286955 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoUse WeakPtr in media Pipeline callbacks.
xhwang@chromium.org [Thu, 31 Jul 2014 13:16:38 +0000 (13:16 +0000)]
Use WeakPtr in media Pipeline callbacks.

Now we destroy AudioRenderer and VideoRenderer in Pipeline::DoStop(). However,
when DoStop() is called, we could have callbacks (e.g. time_cb, ended_cb etc)
already posted by AudioRenderer and VideoRenderer. After DoStop(), the Pipeline
could be destroyed, executing those previously posted callbacks would cause
crash because we bind the callbacks using base::Unretained(this).

This CL changes the Pipeline callbacks to use weak pointer instead of
base::Unretained(this) so that the previously posted callbacks will be
dropped quietly if they are executed after the pipeline is destroyed.

Note that weak pointers should only be evaluated on the thread it's created,
so I am adding several PostTask() and/or thread check to enforce this.

BUG=349211,397656,397582
TEST=All existing tests pass.

Review URL: https://codereview.chromium.org/417303004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286787 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoPipeline: Handle the case where Seek() is called after error happened.
xhwang@chromium.org [Thu, 31 Jul 2014 13:15:28 +0000 (13:15 +0000)]
Pipeline: Handle the case where Seek() is called after error happened.

This happened once during local testing where the demuxer is reporting an error.

TEST=Added unit test to cover this case.

Review URL: https://codereview.chromium.org/433583002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286786 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoCast: Build cast targets with GN
hclam@chromium.org [Thu, 31 Jul 2014 08:56:26 +0000 (08:56 +0000)]
Cast: Build cast targets with GN

Most files and targets are compiling and built, except those that depend
on libvpx.

Adding source sets for:
* cast:common
* cast:net
* cast:sender
* cast:receiver
* cast:test_support

Added executables:
* cast:cast_unittests
* cast:udp_proxy
* cast:generate_timecode_audio
* cast:generate_timebar_video

Review URL: https://codereview.chromium.org/404323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286723 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoClean up. Experimental user avatars removed.
merkulova@chromium.org [Thu, 31 Jul 2014 00:51:41 +0000 (00:51 +0000)]
Clean up. Experimental user avatars removed.

BUG=387738

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284666

Review URL: https://codereview.chromium.org/395133002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286661 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoCast: UDP socket operation should be more resilient
hclam@chromium.org [Thu, 31 Jul 2014 00:06:02 +0000 (00:06 +0000)]
Cast: UDP socket operation should be more resilient

UDP socket has transient errors. In cast if we have an unsuccessful
read followed by an unsuccessful write then socket reading will stop.
This can cause the stream to be stopped until there is a successful
send again.

We should ignore any UDP socket errors and keep going.

Also changed the code location such that we start receiving
packets when CastTransportSender is created.

Testing

This change interacts directly with system UDP sockets so
it is not mockable. Instead I tested this locally with
streaming went smoothly.

BUG=396138

Review URL: https://codereview.chromium.org/409163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286646 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoCast: Build fix for linux_chromium_chromeos_ozone bots
spang@chromium.org [Wed, 30 Jul 2014 22:44:33 +0000 (22:44 +0000)]
Cast: Build fix for linux_chromium_chromeos_ozone bots

This code says OS_LINUX when it should say USE_X11.

TBR=miu

Review URL: https://codereview.chromium.org/426313002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286622 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoDisable DemuxerPerfTest.Demuxer on Windows since it takes longer than the test launch...
jam@chromium.org [Wed, 30 Jul 2014 19:27:19 +0000 (19:27 +0000)]
Disable DemuxerPerfTest.Demuxer on Windows since it takes longer than the test launcher timeout to run.

BUG=399002
TBR=rileya@chromium.org

Review URL: https://codereview.chromium.org/425283006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286581 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoRemove track_uid_ to avoid uint64 parsing issues with MSb set.
tbutter@gmail.com [Wed, 30 Jul 2014 17:08:06 +0000 (17:08 +0000)]
Remove track_uid_ to avoid uint64 parsing issues with MSb set.
It was only added to set the ID for text tracks. Text tracks now use
TrackNum instead of TrackUID as in the updated
http://dev.w3.org/html5/html-sourcing-inband-tracks/#webm

Test WebMTracksParserTest.HighTrackUID added.

BUG=397067

Review URL: https://codereview.chromium.org/418183005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286543 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoMediaUrlInterceptor for embedders to handle custom urls.
igsolla@chromium.org [Wed, 30 Jul 2014 14:02:00 +0000 (14:02 +0000)]
MediaUrlInterceptor for embedders to handle custom urls.

This change adds a MediaUrlInterceptor that content embedders
can register to handle custom urls. The MediaUrlInterceptor
translates a url into a media file. The motivation for this change
is to allow the Android WebView to play media files from the
assets in the apk.

BUG=387898

Review URL: https://codereview.chromium.org/411353002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286506 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoUse validating form of IPC enum macros for media:: types.
tsepez@chromium.org [Wed, 30 Jul 2014 07:02:55 +0000 (07:02 +0000)]
Use validating form of IPC enum macros for media:: types.

This avoids a NULL deref and a browser DoS should a renderer send
an out-of-range type. This is easily hit with the IPC fuzzer but
unlikely to occur otherwise.

Review URL: https://codereview.chromium.org/421743002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286424 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoFix AnnexB validation logic to work with encrypted content.
acolwell@chromium.org [Wed, 30 Jul 2014 01:25:34 +0000 (01:25 +0000)]
Fix AnnexB validation logic to work with encrypted content.

AVC::IsValidAnnexB() would fail if encrypted sections happened to
contain something that looked like an Annex B start code. This change
updates the H264Parser so that it will skip byte sequences that look
like start codes in the encrypted sections of the buffer.

BUG=372617
TEST=AVCConversionTests updated to include fake start codes in the
  encrypted sections.

Review URL: https://codereview.chromium.org/379983002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286373 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoGN: Make chrome/{browser,common,renderer} compile on mac
jamesr@chromium.org [Wed, 30 Jul 2014 00:40:03 +0000 (00:40 +0000)]
GN: Make chrome/{browser,common,renderer} compile on mac

This adds GN rules for google_toolbox_for_mac and generate_localize as
well as fixing up various source issues that show up on the mac build.
With this chrome/{browser,common,renderer} compile on mac (but probably
don't fully link).

R=brettw@chromium.org

Review URL: https://codereview.chromium.org/407093015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286364 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoFix device id matching in AudioDeviceListenerWin::OnDefaultDeviceChanged. The origina...
tommi@chromium.org [Tue, 29 Jul 2014 12:05:53 +0000 (12:05 +0000)]
Fix device id matching in AudioDeviceListenerWin::OnDefaultDeviceChanged. The original problem was pointed out by Nico here: https://codereview.chromium.org/187593004 And discussed further here: https://codereview.chromium.org/419323002/

TBR=thakis@chromium.org
BUG=347531

Review URL: https://codereview.chromium.org/416173004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286176 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoSkip Tags Element to parse WebM Files containing Tags
tbutter@gmail.com [Tue, 29 Jul 2014 08:10:52 +0000 (08:10 +0000)]
Skip Tags Element to parse WebM Files containing Tags

BUG=227382

R=acolwell@chromium.org

Review URL: https://codereview.chromium.org/419333002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@286121 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoMake content_shell link in the GN build.
brettw@chromium.org [Mon, 28 Jul 2014 19:47:04 +0000 (19:47 +0000)]
Make content_shell link in the GN build.

It doesn't run yet. This disables WebRTC since that's not done yet.

Libvpx isn't done either. This patch exports the disable flag for this from media to dependent targets like the GYP build does. It adds one extra check for this flag in Pepper. I assume everybody that compiles without libvpx also disables plugins so this has never come up before.

Disable some warnings in Mesa.

The resulting binary does not yet run.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/419913003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285962 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoRevert 285479 "Make DataSource::Stop() synchronous."
inferno@chromium.org [Mon, 28 Jul 2014 02:50:44 +0000 (02:50 +0000)]
Revert 285479 "Make DataSource::Stop() synchronous."

Causing UAFs on ClusterFuzz

BUG=397656

> Make DataSource::Stop() synchronous.
>
> In a lot of filters in media code, Stop() has been folded into the dtor.
> This model doesn't apply directly to DataSource because DataSource::Stop()
> is called by the FFmpegDemuxer, but the DataSource is owned by
> WebMediaPlayerImpl.
>
> TBR=gbillock@chromium.org
> BUG=349211
> TEST=All existing tests pass.
>
> Review URL: https://codereview.chromium.org/413243002

TBR=xhwang@chromium.org

Review URL: https://codereview.chromium.org/421843004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285858 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoclang/win: Fix a few warnings.
thakis@chromium.org [Sun, 27 Jul 2014 11:30:45 +0000 (11:30 +0000)]
clang/win: Fix a few warnings.

__THROW is not some magical thing, don't pretend it is. Don't add it to
extern "C" functions. Replace it with "throw ()" on the functions where it's
correct since it was defined to nothing on windows (the only place where this
file is used).

Fix an inconsequential enum constant mix-up in media (both enum constants
evaluated to the same value, and the enums had the same size, so it shouldn't
make a difference in practice, but the old code was comparing enum variables
with enum constants from a different enum).

BUG=82385
TBR=dalecurtis

Review URL: https://codereview.chromium.org/419323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285838 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoFix two uninitialized variables in media.
wfh@chromium.org [Sat, 26 Jul 2014 01:33:23 +0000 (01:33 +0000)]
Fix two uninitialized variables in media.

BUG=397762
TEST=compile with no errors
R=dalecurtis@chromium.org

Review URL: https://codereview.chromium.org/413393006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285741 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoUpdate browser tests to support upcoming EME parameter type changes.
jrummell@chromium.org [Fri, 25 Jul 2014 20:50:14 +0000 (20:50 +0000)]
Update browser tests to support upcoming EME parameter type changes.

The EME spec is now using ArrayBuffer/ArrayBufferView instead of
Uint8Array as the type for data buffers. Calls from JavaScript
aren't affected as Uint8Array is an ArrayBufferView. However,
"message" events now pass back an ArrayBuffer and the tests expect
Uint8Array. This converts the returned message to a Uint8Array
to keep the code working.

This change works with and without the upcoming changes. If
Uint8Array is passed back, then the result is that another copy of
the view is made.

BUG=358271
TEST=encrypted media browser_tests pass

Review URL: https://codereview.chromium.org/405733003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285672 0039d316-1c4b-4281-b951-d872f2087c98

2 months agoUpdate VP9 444 tests
johannkoenig@chromium.org [Fri, 25 Jul 2014 17:26:05 +0000 (17:26 +0000)]
Update VP9 444 tests

Files re-encoded with the updated bitstream:
$ ffmpeg -i blackwhite.png -pix_fmt yuv444p blackwhite.y4m
$ vpxenc --codec=vp9 --profile=1 --experimental-bitstream -o
blackwhite_yuv444p.webm blackwhite.y4m
$ ffmpeg -i bear-1280x720.mp4 -vf crop=960:720:0:160,scale=320:240
-pix_fmt yuv444p bear-320x240-P444.y4m
$ vpxenc --codec=vp9 --profile=1 --experimental-bitstream -o
bear-320x240-P444.webm bear-320x240-P444.y4m

BUG=392309
R=scherkus@chromium.org

Review URL: https://codereview.chromium.org/396543003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src/media@285613 0039d316-1c4b-4281-b951-d872f2087c98