Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to check and show no-signal preview #79

Merged
merged 7 commits into from Feb 10, 2015
Merged

Conversation

ApsOps
Copy link
Member

@ApsOps ApsOps commented Sep 3, 2014

When collectors error, encoders change to "hungry" for feed. In this situation, previews change to a "No signal" image.

url = "http://" + group + ".encoder.timvideos.us:8081/loop.raw"
print "scanning " + group
try:
r = requests.get(url, stream=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does requests.get return? When the header is available?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requests.get fails if the stream is not accessible, either encoder server is shut down or, it's running but flumotion is stopped.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with the stream is accessible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTP response object from https://ROOMNAME.encoder.timvideos.us:8081/loop.raw is stored in r and looks something like this:

HTTP/1.0 200 OK
date: Sun, 07 Sep 2014 20:55:57 GMT
connection: close
cache-control: private
content-type: video/x-flv
server: FlumotionHTTPServer/0.11.0.1

When encoder goes hungry, the content-type changes to "None".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm asking is, does "requests.get" return when after the headers? Or does it wait for data?

It seems like you want to be using HEAD function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I have written "stream=True", the request won't continue forever (it will just get a small chunk). But I think you are right, HEAD function should be enough.

@mithro
Copy link
Member

mithro commented Nov 7, 2014

@aps-sids Still a couple of comments on this to reply.

@ApsOps
Copy link
Member Author

ApsOps commented Nov 7, 2014

I am still thinking, how to go about using argparse and config.json, will probably look at it this weekend.

@ApsOps ApsOps self-assigned this Dec 23, 2014
@mithro
Copy link
Member

mithro commented Jan 12, 2015

@aps-sids I'd love to use this. What do you think is left to finish this off?

@ApsOps
Copy link
Member Author

ApsOps commented Jan 12, 2015

@mithro It needs to be merged with the generate.sh script, removing whole hard-coded stuff.

@mithro
Copy link
Member

mithro commented Jan 31, 2015

@aps-sids Now you have some time, can you take another look at this?

@ApsOps
Copy link
Member Author

ApsOps commented Feb 4, 2015

pngcrush functionality needs to be added.

@CarlFK
Copy link
Contributor

CarlFK commented Feb 4, 2015

What is pngcrush?

On Wed, Feb 4, 2015 at 1:48 PM, Amanpreet Singh notifications@github.com
wrote:

pngcrush functionality needs to be added.


Reply to this email directly or view it on GitHub
#79 (comment)
.

Carl K

@ApsOps
Copy link
Member Author

ApsOps commented Feb 4, 2015

Images created by this are >100 KB in size so we need to compress them.
Take a look at existing generate.sh script.
On Feb 5, 2015 1:59 AM, "Carl Karsten" notifications@github.com wrote:

What is pngcrush?

On Wed, Feb 4, 2015 at 1:48 PM, Amanpreet Singh notifications@github.com
wrote:

pngcrush functionality needs to be added.

Reply to this email directly or view it on GitHub
<
#79 (comment)

.

Carl K

Reply to this email directly or view it on GitHub
#79 (comment)
.

@mithro
Copy link
Member

mithro commented Feb 6, 2015

Just use subprocess.check_call to call pngcrush directly.

@CarlFK
Copy link
Contributor

CarlFK commented Feb 6, 2015

I don't see a problem with >100 KB images. This is the exception to showing a video, so minimal in comparison.

@mithro
Copy link
Member

mithro commented Feb 6, 2015

@CarlFK this takes over the job of the old preview generation script and instead generates no-signal image when there is no video coming through. Hence it needs to produce small PNGs when the signal is coming through.

bus = pipeline.get_bus()
pipeline.set_state(Gst.State.PLAYING)
bus.poll(Gst.MessageType.EOS, Gst.CLOCK_TIME_NONE)
pipeline.set_state(Gst.State.NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a #FIXME: This should return true if the preview was generated

@ApsOps
Copy link
Member Author

ApsOps commented Feb 10, 2015

@mithro This is good to go except that we need to make it threaded. Should the whole thing be made threaded or just the preview generation (gstreamer) part?

@mithro
Copy link
Member

mithro commented Feb 10, 2015

I'll merge this now. Please another pull request with the threading fixes.

mithro added a commit that referenced this pull request Feb 10, 2015
Add script to check and show no-signal preview.
@mithro mithro merged commit 0d9caab into master Feb 10, 2015
@mithro mithro deleted the check-signal branch February 10, 2015 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants