videoSampleAccess / audioSampleAccess question

328 views
Skip to first unread message

Benoit Beausejour

unread,
Apr 13, 2011, 1:40:05 PM4/13/11
to C++ RTMP Server
Hi!

We're trying to use crtmpserver (which works beautifully) on streams
in Flash.

We want to use BitmapData.draw from flash to capture the pixels into
thumbnails inside the flash app. We receive a security sandbox
violation error from Flash when trying to do this.

Error #2123: Security sandbox violation: BitmapData.draw:
http://host/static/swf/App.swf cannot access rtmp://rtmpserver/flvplayback.
No policy files granted access.

Usually under FMS, there is a flag we can set in the config file to
enable video/audio sample access from Flash client.

Is there a way to active this in crtmpserver and or are we missing
something basic to get this work ?

Any help is appreciated !

thanks!

-b

C++ RTMP Server

unread,
Apr 13, 2011, 4:33:13 PM4/13/11
to c-rtmp...@googlegroups.com
Can you provide a link for the docs describing this? I'm referring to FMS setting...

Cheers,
Andrei

> You received this message because you are subscribed to "C++ RTMP Server" mailing list.
> To post to this group, send email to c-rtmp...@googlegroups.com
> To unsubscribe from this group, send email to
> c-rtmp-serve...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/c-rtmp-server?hl=en

------
Eugen-Andrei Gavriloaie
Web: http://www.rtmpd.com

Benoit Beausejour

unread,
Apr 13, 2011, 5:17:36 PM4/13/11
to C++ RTMP Server
Hi there!

Thanks for answering :)

Here is the relevant doc from FMS:

http://livedocs.adobe.com/flashmediaserver/3.0/docs/help.html?content=08_xmlref_168.html

There's also audioSampleAccess. These are options to the actual
applications.

thanks!

-b

On Apr 13, 4:33 pm, C++ RTMP Server <crtmpser...@gmail.com> wrote:
> Can you provide a link for the docs describing this? I'm referring to FMS setting...
>
> Cheers,
> Andrei
> On Apr 13, 2011, at 8:40 PM, Benoit Beausejour wrote:
>
>
>
>
>
>
>
>
>
> > Hi!
>
> > We're trying to use crtmpserver (which works beautifully) on streams
> > in Flash.
>
> > We want to use BitmapData.draw from flash to capture the pixels into
> > thumbnails inside the flash app. We receive a security sandbox
> > violation error from Flash when trying to do this.
>
> > Error #2123: Security sandbox violation: BitmapData.draw:
> >http://host/static/swf/App.swfcannot access rtmp://rtmpserver/flvplayback.

Support Team

unread,
Apr 13, 2011, 6:18:19 PM4/13/11
to c-rtmp...@googlegroups.com
You might need to run a policy file server wich serves up the policy.xml that flash requires.

Bellesoft.

C++ RTMP Server

unread,
Apr 14, 2011, 3:11:28 AM4/14/11
to c-rtmp...@googlegroups.com
Unfortunately, that is not possible because crtmpserver doesn't do any re-encoding.

Sorry...


Cheers,
Andrei

Max Lapshin

unread,
Apr 14, 2011, 4:19:54 AM4/14/11
to c-rtmp...@googlegroups.com, C++ RTMP Server
On Thu, Apr 14, 2011 at 11:11 AM, C++ RTMP Server <crtmp...@gmail.com> wrote:
> Unfortunately, that is not possible because crtmpserver doesn't do any re-encoding.
>

I think, he is speaking not about recoding, but about |RtmpSampleAccess

Benoit Beausejour

unread,
Apr 14, 2011, 10:43:39 AM4/14/11
to C++ RTMP Server


On Apr 14, 4:19 am, Max Lapshin <max.laps...@gmail.com> wrote:
> On Thu, Apr 14, 2011 at 11:11 AM, C++ RTMP Server <crtmpser...@gmail.com> wrote:
>
> > Unfortunately, that is not possible because crtmpserver doesn't do any re-encoding.
>
> I think, he is speaking not about recoding, but about |RtmpSampleAccess

Precisely, this is not asking the server to reencode, but really to
permit the client from capturing the stream data by taking pixel
snapshots.

On the flash end, there is no need for a policy file, even though that
is what the error message specifies.

In FMS, you permit this action by specifying the videoSampleAccess and
audioSampleAccess values in your server-side ActionScript application.
This is specific to Flash.

Here is a relevant thread:
http://forums.adobe.com/thread/632355?decorator=print&displayFullThread=true

It seems Max is right on the money with sending |RtmpSampleAccess to
the client , it seems that's what the underlying action is.

Can this work in crtmpserver?

-b

C++ RTMP Server

unread,
Apr 14, 2011, 11:02:07 AM4/14/11
to c-rtmp...@googlegroups.com

crtmpserver already sends RtmpSampleAccess status message. But I'm not totally sure about what is about to happen next. But I think the server should return a raw uncompressed image.

Your initial link:
http://livedocs.adobe.com/flashmediaserver/3.0/docs/help.html?content=08_xmlref_168.html

Clearly states:
"Allows the client application to access the raw uncompressed video data in a stream."

Now, who is going to give that uncompressed video data? Flash player after getting the compressed data? Or the server has to actually uncompress (decode) it?

Cheers,
Andrei

>
> Can this work in crtmpserver?
>
> -b
>

C++ RTMP Server

unread,
Apr 14, 2011, 11:05:46 AM4/14/11
to c-rtmp...@googlegroups.com
You can always try to modify how I send that message by setting last 2 parameters to true.

Go to sources/thelib/src/protocols/rtmp/streaming/baseoutnetrtmpstream.cpp:352

and modify:
_pChannelAudio->id, _rtmpStreamId, 0, true, false, false);

to:
_pChannelAudio->id, _rtmpStreamId, 0, true, true, true);

See how that works

Cheers,
Andrei

Benoit Beausejour

unread,
Apr 14, 2011, 6:09:52 PM4/14/11
to C++ RTMP Server
That worked beautifully, though I had to do a little more work then
that.

in void BaseOutNetRTMPStream::SignalAttachedToInStream(), I added the
following code after stream begin to allow Video samples:


+ //XXX. notify |RtmpSampleAccess
+ /*
+ message = StreamMessageFactory::GetNotifyRtmpSampleAccess(
+ _pChannelVideo->id, _rtmpStreamId, absoluteTimestamp, false, true,
true);
+ TRACK_MESSAGE("Message:\n%s", STR(message.ToString()));
+ if (!_pRTMPProtocol->SendMessage(message)) {
+ FATAL("Unable to send message");
+ _pRTMPProtocol->EnqueueForDelete();
+ return false;
+ }
+ */
+

Also in the same method, changed the same call for the audio channel:

//10. notify |RtmpSampleAccess
message = StreamMessageFactory::GetNotifyRtmpSampleAccess(
_pChannelAudio->id, _rtmpStreamId, 0, true, true, true);
TRACK_MESSAGE("Message:\n%s", STR(message.ToString()));
if (!_pRTMPProtocol->SendMessage(message)) {
FATAL("Unable to send message");
_pRTMPProtocol->EnqueueForDelete();
return;
}


This works perfectly to get Flash BitmapData.draw() to work on the
RTMP stream. I suggest this be integrated as a configuration option to
each application so it would be possible to do something like from the
app configuration:

{
description="FLV Playback Sample",
name="flvplayback",
protocol="dynamiclinklibrary",
aliases=
{
"simpleLive",
"vod",
"live",
"WeeklyQuest",
"SOSample",
"oflaDemo",
},
acceptors =
{
{
ip="0.0.0.0",
port=1935,
protocol="inboundRtmfp"
},
{
ip="0.0.0.0",
port=6666,
protocol="inboundLiveFlv",
waitForMetadata=true,
},
{
ip="0.0.0.0",
port=9999,
protocol="inboundTcpTs"
},
--[[{
ip="0.0.0.0",
port=554,
protocol="inboundRtsp"
},]]--
},
externalStreams =
{
validateHandshake=true,
keyframeSeek=true,
seekGranularity=1.5, --in seconds, between 0.1 and 600
clientSideBuffer=12, --in seconds, between 5 and 30
allowVideoSampleAccess=true,
allowAudioSampleAccess=true,
},


A big thanks for pointing me in the right direction!

-b
Reply all
Reply to author
Forward
0 new messages