MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » Development » Submit: code patches (MediaPortal/TV-Server/etc.)


Reply
 
LinkBack Thread Tools Display Modes
Old 2009-11-22, 23:35   #1 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

fixed TVPlugin: Audio stream is not selected correctly

Hi!

When you have setup Prefer-AC3 but NOT Prefer-AC3 over language and you have a stream with MPEG and AC3 both with correct language MP selects MPEG stream instead of AC3 stream. This is caused by a useless if condition which skips the scanning of additional streams after finding the first one.

EDIT: For patch see Post 4

Stefan
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG

Last edited by disaster123; 2009-11-23 at 23:53..
disaster123 is offline   Reply With Quote
Old 2009-11-23, 19:17   #2 (permalink)
Portal Tester
 
Join Date: Apr 2008
Posts: 221
Thanks: 9
Thanked 15 Times in 15 Posts

Country:


Default

I do not think it's useless because in some cases it's possible that the wrong language is set as preferred language otherwise.
For example, you have set up english as first priority language and german as second. Then if the stream includes both these languages with english as stream0 and german as stream1 then without the priority check german or stream1 will be selected because it's also in the preferred list but with higher index in the stream array so it will be selected as the streams array is iterated.

I can see that in you're case it's not working correct either but your solution will break it for others, so I think you'll have to come up with another solution.


//johnzered
johnzered is offline   Reply With Quote
Old 2009-11-23, 22:15   #3 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

Default

ah OK - it's for the priority in list - but the code is still wrong. Will provide a second patch - haven't thought about that cause i only use "one" language :-)
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG

Last edited by disaster123; 2009-11-23 at 22:34..
disaster123 is offline   Reply With Quote
Old 2009-11-23, 23:52   #4 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

Default

Here is a new clean fine working and tested patch. It also keeps now the lang priority.
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG
disaster123 is offline   Reply With Quote
Old 2009-11-24, 19:09   #5 (permalink)
Portal Developer
 
gibman's Avatar
 
Join Date: Oct 2006
Location: Aarhus
Posts: 1,209
Thanks: 13
Thanked 153 Times in 87 Posts

Country:

My System

Default

It's tough figuring out what possible side effect(s) changes to this part of the code can have.

What we need is some 20-30 unit tests for this specific method.

Any volunteers.

Then it's just a matter of writing tests for all the different scenarios we know.

/gibman

Quote:
Originally Posted by disaster123 View Post
Here is a new clean fine working and tested patch. It also keeps now the lang priority.
__________________
"It's all a big foodchain.
We eat shit and shit eats us."
gibman is online now   Reply With Quote
Old 2009-11-24, 19:57   #6 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

Default

I think it's really simple to understand what happens if you remove the lines which simply rename a variable to something more meaningful. So this cannot break anything.
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG
disaster123 is offline   Reply With Quote
Old 2009-11-24, 20:27   #7 (permalink)
Portal Developer
 
gibman's Avatar
 
Join Date: Oct 2006
Location: Aarhus
Posts: 1,209
Thanks: 13
Thanked 153 Times in 87 Posts

Country:

My System

Default

It might be simple to understand ... but it still handles a lot of different cases.

Having a unit test for each of these would be the most optimal thing to do (imho).

I wasnt thinking about the renaming part- this should be safe as u say.

/gibman
__________________
"It's all a big foodchain.
We eat shit and shit eats us."
gibman is online now   Reply With Quote
Old 2009-11-24, 21:59   #8 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

Default

OK :-) So now we need testers?
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG
disaster123 is offline   Reply With Quote
Old 2009-11-25, 13:39   #9 (permalink)
Portal Developer
 
gibman's Avatar
 
Join Date: Oct 2006
Location: Aarhus
Posts: 1,209
Thanks: 13
Thanked 153 Times in 87 Posts

Country:

My System

Default

No not testers but programmers willing to write some unit tests.

a unit test is simply code that tests and verifies the correctness of other code (production code).
ex. does the GetPreferedAudioStreamIndex return the correct index value based on input params etc.

Having a bunch of solid unit tests both for the server and client parts will insure us a more stable product.
When modifying existing code that is unit tested gives us the benefit of knowing wether or not the modification broke the already existing unit tests.

Simply done by running all unit tests
If they fail, we either introduced a bug, or we need to adapt the existing unit tests to the new change.


install :
NUnit - Home
TestDriven.Net > Home

A standalone assembly/project should be created (TvPluginTests)
Then we could start by adding a single class to the project called "TvHomeTest.cs"

Add a reference to the nunit binaries (nunit.framework.dll) in that TvPluginTests project.
Also add a reference to the tvplugin assembly.

In the "TvHomeTest" class add ; using NUnit.Framework;

Now we're set.

The "TvHomeTest" should test all relevant functions within the TvHome class in tvplugin.
We want to focus on the GetPreferedAudioStreamIndex function.

Lots of tutorials on google.
NUnit: A tutorial Selva [Ne0] Samuel

/gibman

Quote:
Originally Posted by disaster123 View Post
OK :-) So now we need testers?
__________________
"It's all a big foodchain.
We eat shit and shit eats us."

Last edited by gibman; 2009-11-25 at 13:49..
gibman is online now   Reply With Quote
Old 2009-11-25, 14:26   #10 (permalink)
MP Donator
 
Join Date: May 2008
Age: 28
Posts: 1,928
Thanks: 73
Thanked 185 Times in 87 Posts

Country:

My System

Default

Oh sorry i know what a testunit is - but i can't write one in C#. Sorry - no C# expert.
__________________
IRSS with full Imon Support (all buttons working)
MP Disaster Edition 1.1.0 SVN
- NEW recording option weekly everytime on channel X
- option to deactivate normal home and use only basic home
- comskip network client support
- much more
Episodescanner: adds series and episodenumbers to your MP EPG or 4TR EPG
disaster123 is offline   Reply With Quote
Reply

Bookmarks

Tags
audio, selected, stream, tvplugin

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
0002560: TVPlugin: Audio stream is not selected correctly MediaPortal-Bot Bugtracker Feed 0 2009-11-26 15:10
0001277: [TvPlugin] TVService is not available, leaving TVplugin by ESC is not possib johnzered 1.0 RC1 and SVN Builds 3 2008-06-04 22:43
BUG: Audio not restored between Radio Stream and TV Stream AmenRa Television (MyTV frontend and TV-Server) 0 2007-12-07 00:34
TvPlugin: Preferred audio stream setting gemx MediaPortal 1 Talk 15 2007-07-15 18:01


All times are GMT +1. The time now is 17:59.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2 Protected by Akismet Blog with WordPress
Advertisement System V2.6 By   Branden